[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: diff/patch incompatibility with -p and crlf
From: |
Andreas Gruenbacher |
Subject: |
Re: diff/patch incompatibility with -p and crlf |
Date: |
Sun, 22 Mar 2009 20:49:35 +0100 |
User-agent: |
KMail/1.9.9 |
On Tuesday, 6 September 2005 19:00:20 Egmont Koblinger wrote:
> Hi,
>
> I found a strange incompatibility between diffutils 2.8.1 and patch 2.5.4.
> There's a special case when a patch generated by "diff" cannot be applied
> by "patch".
>
> If the file to be patched has DOS-style CR-LF newlines, and the "-p" option
> of diff is being used, then in the generated patch the "@@" lines will also
> end with CR-LF since a function name (a line of the source code which ends
> in a CR-LF) is copied there.
>
> When trying to apply such a patch, the patch utility, seeing that the "@@"
> line also ends in CR-LF, believes that the file should not contain CR's
> (maybe it was incorrectly transferred through ASCII FTP or similar channel)
> and automatically strips all the CR's from the file. And then applying the
> result will fail since important CR's are missing from the end of
> subsequent lines.
>
> I believe that "diff" is buggy, it should make sure not to put CR at the
> end of the "@@" lines.
This was actually fixed in patch by Paul Eggert after 2.5.9. The fix is here:
http://git.savannah.gnu.org/cgit/patch.git/commit/?id=12c0847f
The alpha version at ftp://alpha.gnu.org/gnu/patch already incudes the fix. I
have added a regression test now.
Andreas
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: diff/patch incompatibility with -p and crlf,
Andreas Gruenbacher <=