More insane patch behavior.

Rob Landley rob at landley.net
Sat Aug 21 23:47:21 UTC 2010


So I'm trying to build a Gentoo Stage 1 on top of busybox, uClibc, and a
native toolchain, and emerge is hanging doing this:

patch -p0 --dry-run /var/tmp/portage/sys-apps/util-linux-2.17.2/work/util-linux-ng-2.17.2/config/install-sh install-
sh/1.5.6

That's the first time I've ever actually seen anything use the patch behavior:

patch [options] [file-to-patch [patchfile]]

So if there's an unused extra filename, it's the name of the file to patch
(overriding the +++ and --- lines for all hunks, apparently), and if there's
an extra file after that it works like -i was specified.

I know how to make toybox do that (option parsing happens before main() gets
called, the stuff your option string expresses interest in gets filled out in
your global struct, and the remaining option array is toys.optargs[]), but
have no idea how to make the strange getopt32() stuff busybox is using do that
(you have to pass varargs to your function call and then the optargs wind up
where?  And if you need to pluck interspersied -options out of the leftover
optargs you reorder the argv[] passed into you by the environment so you
contaminate what ps shows?  I may have known this at one point, but remember
none of it...)

Rob
-- 
GPLv3: as worthy a successor as The Phantom Menace, as timely as Duke Nukem
Forever, and as welcome as New Coke.


More information about the busybox mailing list