bug-diffutils
[Top][All Lists]
Advanced

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

Re: [bug-diffutils] diff and symlinks


From: Andreas Gruenbacher
Subject: Re: [bug-diffutils] diff and symlinks
Date: Sat, 4 Dec 2010 17:38:10 +0100
User-agent: KMail/1.12.4 (Linux/2.6.36-rc7+; KDE/4.3.5; i686; ; )

On Saturday 04 December 2010 09:44:58 Hugo Mildenberger wrote:
> Almost a month ago, in a message to bug-diffutils, I described the inverse
> of this problem: running diff against a non-existing file and an equally
> named existing file file of zero length resulted in no output. Any real
> version of patch therefore has no chance to create that file. I repeat my
> example here:
> 
> $ diff --version
> $ diff (GNU diffutils) 3.0
> Packaged by Gentoo (3.0)
> 
> $ mkdir a/c -p
> $ mkdir b/c -p
> $ touch b/c/emptyfile
> $ diff -urN a b

This is tricky problem because diff hasn't distinguished this case before, so 
such diffs would cause existing implementations of patch (not only GNU patch) 
to behave differently.  For example, GNU patch doesn't like unified diffs like 
this:

        $ cat remove-empty.diff
        --- f
        +++ /dev/null
        @@ -0,0 +0,0 @@
        $ echo -n '' > f
        $ patch -x4 -p0 < remove-empty.diff
        patching file f
        patch: **** malformed patch at line 3: --- 1,0 ----

Recent alpha versions get the following patch "right" though:

        $ cat remove-empty.diff
        *** f
        --- /dev/null
        ***************
        *** 0 ****
        --- 0 ----
        $ echo -n '' > f
        $ patch -x4 -p0 < remove-empty.diff
        patching file f
        Removing file f


Any thoughts?


Thanks,
Andreas



reply via email to

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