Subject: Re: Reverse-patching empty files
To: Julio M. Merino Vidal <jmmv84@gmail.com>
From: Gavan Fantom <gavan@coolfactor.org>
List: tech-userlevel
Date: 08/22/2006 12:09:27
Julio M. Merino Vidal wrote:
> Hi,
> 
> A test case in Monotone tries to apply a patch to an empty file in
> reverse form.  This works OK with GNU patch (2.5.9) but fails with
> ours.  Consider the following commands which illustrate the problem:
> 
> $ echo 1 >foo.old
> $ echo 2 >>foo.old
> $ touch foo
> $ diff -u foo.old foo >patch.diff
> $ patch -p0 -R <patch.diff
> Hmm...  Looks like a unified diff to me...
> The text leading up to this was:
> --------------------------
> |--- foo.old    2006-08-22 10:55:49.000000000 +0200
> |+++ foo        2006-08-22 10:55:49.000000000 +0200
> --------------------------
> Patching file foo using Plan A...
> Hunk #1 failed at 1.
> 1 out of 1 hunks failed--saving rejects to foo.rej
> done
> 
> Is this a bug in our patch?  Or there is nothing that requires it to
> behave this way?

I see nothing in SUS that requires it to behave this way. It is also
counterintuitive that it should fail here.

I think it's a bug.

-- 
Gillette - the best a man can forget