hmm, i might have run into the -R issue by accident while testing my change the other day. this is the most recently added item on my list of "things to investigate later" (the patch below is just a stupid change i made for testing)...
/tmp/toybox$ cat patch diff --git a/lib/lib.c b/lib/lib.c index 2250caf4..381173ee 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -1,5 +1,4 @@ /* lib.c - various reusable stuff. - * * Copyright 2006 Rob Landley <[email protected]> */ /tmp/toybox$ ./toybox patch -p1 < patch patching lib/lib.c /tmp/toybox$ git diff diff --git a/lib/lib.c b/lib/lib.c index 2250caf4..381173ee 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -1,5 +1,4 @@ /* lib.c - various reusable stuff. - * * Copyright 2006 Rob Landley <[email protected]> */ /tmp/toybox$ ./toybox patch -R -p1 < patch patching lib/lib.c Hunk 1 FAILED 1/1. /* lib.c - various reusable stuff. - * * Copyright 2006 Rob Landley <[email protected]> */ /tmp/toybox$ yeah, looks like it. if i switch instead to a first hunk that adds something (like below) -R works. /tmp/toybox$ cat patch diff --git a/lib/lib.c b/lib/lib.c index 2250caf4..b57d7970 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -1,6 +1,7 @@ /* lib.c - various reusable stuff. * * Copyright 2006 Rob Landley <[email protected]> + * */ #define SYSLOG_NAMES /tmp/toybox$ On Sat, Dec 21, 2019 at 12:00 AM Rob Landley <[email protected]> wrote: > > On 12/20/19 12:48 PM, enh via Toybox wrote: > > POSIX only mentions -i/stdin, but GNU patch -- and Larry Wall's patch 1.3, > > found via https://en.wikipedia.org/wiki/Patch_(Unix) -- also support > > supplying the name of the file to patch and the name of the patch file > > as optional arguments. > > If Larry Wall's original patch supports it, it's not gnu style is it? :) > > Applied, but I noticed there's no patch.tests so started doing some simple > ones, > and I hit the corner case that each patch has TWO filenames and the debian > patch > will use _either_ filename if the first doesn't exist, and mine won't. > > The thing is... nobody's ever _noticed_. I can add this fallback behavior, > but... I think the current code is using the +++ line when the first thing we > do > is + and the --- line when the first thing we do is - and that seems to be > more > correct? (Modulo -R which again, does not appear to have come up?) > > I'm... not sure if I _should_ add the extra plumbing? (I'm pretty sure I was > aware of this issue way back when and chose _not_ to, although I'd have to dig > into the mailing list or blog to see if I documented _why_. There's a lot of > https://landley.net/notes-2007.html#29-12-2007 entries from back then. And yes > https://web.archive.org/web/20060325013934/http://kernelslacker.livejournal.com/7336.html > is why I didn't implement fuzz factor support...) > > Rob _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
