More insane patch behavior.
rob at landley.net
Tue Aug 24 19:10:34 UTC 2010
On Saturday 21 August 2010 22:44:02 Denys Vlasenko wrote:
> On Sunday 22 August 2010 01:47, Rob Landley wrote:
> > 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/con
> >fig/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.
> Wow. bbox had this in help text, but did not actually support.
I've never seen anything _use_ it before now...
> > 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?
> Similarly to getopt, after getopt32() argv[optind] is the first non-option
> parameter. I usually put argv += optind; right after getopt32(),
> which means I can use argv after that (smaller code).
Eh, I'm just spoiled. :)
> > 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 think only argv pointers are permutated, not the strings they point to.
Long ago, busybox used to modify the arguments that showed in ps, but I
suppose it went out of its way to do so at the time. (I just did a quick test
program and writing to argv didn't do it. *shrug*)
> Anyway, here's the fix in busybox git:
> Let me know whether it works for you.
Yeah, but then a bit later emerge died because it was trying to use --dry-run.
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