/
niceSOFT
/
patch
Обзор
Документация
Войти
/
niceSOFT
/
patch
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tests/unmodified-files
60 строк
1 KB
Paul Eggert
maint: make update-copyright
21 апр 2026, 20:10
21 апр 2026, 20:10
494ee0b
Код
Авторство
О чём код?
# Copyright 2009-2026 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # in any medium, are permitted without royalty provided the copyright # notice and this notice are preserved. . $srcdir/test-lib.sh require cat require hardlinks use_local_patch use_tmpdir # ============================================================== # Bug #25969: Patch replaces unmodified files # # When a patch doesn't actually modify a file (i.e., only rejects), # the file is still replaced. cat > a.diff <<EOF --- a +++ a @@ -1 +1 @@ -one +two EOF echo three > a ln a a.first check 'patch -b -B backup/ a < a.diff || echo "Status: $?"' <<EOF patching file a Hunk #1 FAILED at 1. 1 out of 1 hunk FAILED -- saving rejects to file a.rej Status: 1 EOF ncheck 'test a -ef a.first' check 'cat backup/a' <<EOF three EOF # ============================================================== # When applying an empty patch to a file with -o, copy the input file. cat > a.diff <<EOF EOF echo three > a check 'patch -o b a < a.diff' <<EOF patching file b (read from a) EOF check 'cat b' <<EOF three EOF