Hi Andrew, 2015-06-01 20:16 GMT+02:00 Andrew Church <achu...@achurch.org>: > At some point in the past few years, patch stopped replacing files which > were not modified due to all hunks failing to apply. This breaks the > following pattern: > > $ cp -al package package-orig > $ cd package > $ patch -p1 </tmp/package-fixes.diff > 1 out of 1 hunk FAILED -- saving rejects to file foo.c.rej > $ emacs foo.c{,.rej} # apply them manually > $ rm foo.c.{orig,rej} > $ cd .. > $ diff -urN package{-orig,} > $ # huh, no diffs?
that's when emacs is configured not to break hard links; the same would happen if you edit any other file that patch hasn't modified. > ...because patch leaves the original (hardlinked) file untouched when it > detects that all hunks have failed. This is particularly annoying since > it means patch's behavior is not consistent with respect to hard links: > patch _does_ delink and replace files if some, but not all, hunks fail > to apply. Of course it does when the file changes. > As a result, I have to check each file I intend to edit and > manually "cp foo foo~; mv foo~ foo" if the file has not been modified. ... or fix your emacs configuration, which is what causes the problem. Thanks, Andreas