bug-patch
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-patch] Patch fails to replace unmodified files


From: Andreas Grünbacher
Subject: Re: [bug-patch] Patch fails to replace unmodified files
Date: Mon, 1 Jun 2015 20:51:30 +0200

Hi Andrew,

2015-06-01 20:16 GMT+02:00 Andrew Church <address@hidden>:
> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]