[Toybox] [PATCH] patch: support GNU-style [FILE [PATCH]] arguments.

Rob Landley rob at landley.net
Sat Dec 21 00:03:57 PST 2019


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



More information about the Toybox mailing list