Hi!

Originally reported downstream in Gentoo at
https://bugs.gentoo.org/949834, it appears that GNU patch from git (at
commit 86ac7e2d7b19e2fd9aab58a8cbeeebd5c6343e5c) doesn't respect
--no-backup-if-mismatch: .orig files get created (backup files) despite
the option.

Bisected to:

5bac27450794f2820ea41f2d6d5342c770f36e40 is the first bad commit
commit 5bac27450794f2820ea41f2d6d5342c770f36e40
Author: Andreas Gruenbacher <[email protected]>

    Set --no-backup-if-mismatch when in --posix mode

    When in POSIX mode, the --no-backup-if-mismatch option should be
    enabled.  However, this is only true when the POSIXLY_CORRECT
    environmant variable is set but not when the --posix command line
    option is given.  Fix that by setting backup_if_mismatch after
    evaluating the command line arguments.

 src/patch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 
... where it appears that the value of backup_if_mismatch is discarded,
and it becomes a function purely of whether we're in POSIX mode.

I've attached a trivial reproducer as well. With broken patch, it'll
exit 1, and exit 0 with working patch (2.7.6).

Attachment: patch.sh
Description: no-backup-if-mismatch testcase

thanks,
sam

Reply via email to