[patch] proposed change to busybox option parsing.

Rob Landley rob at landley.net
Sat Sep 3 05:56:03 UTC 2005


Ok, this makes any command starting with "busybox" work as if the command was 
busybox, I.E "./busybox-walrus" is acceptable.  This includes making 
"./busybox-walrus --help thingy" work, in all the various permutations I 
could see.

I ripped out the old option parsing and redid it, because it was gratuitously 
complicated.  Two behavior changes between this and the old parsing:

1) You can now go "./busybox busybox busybox busybox ls" and it'll run ls, 
because I didn't put in the three lines to block it.

I can't see any security implications of this, since if you can supply an 
arbitrary command as the second parameter (to unexpectedly invoke the busybox 
command multiplexor again), then you put any other command there so you can 
already access everything busybox can do anyway.

I can put that back how it was, but why waste the bytes?  (The only other edge 
case I can see is that combined with the new prefix behavior, you need to 
specify a path such as "./busybox-other" to run a different version of 
busybox from the standalone shell.)  It's silly, but busybox is an applet and 
the code is generic now...

2) We don't overwrite our command line arguments to pretend we weren't called 
as ./busybox when we were.  This means "./busybox ls -l" shows up in ps as 
"./busybox ls -l" and not "ls -l".  Which is the truth.  (Why were we going 
out of our way to lie about this when bash and python don't modify their 
arguments to hide the interpreter from ps?  Try "#!/bin/bash\nps ax" or 
"import os\nos.system("ps ax")" if you don't believe me.  I vaguely remember 
exchanging email with Erik about this once, but can't find it just now...)

Again, I could put that back (it's there in this patch, commented out): but 
why?

Here's the patch.  Let me know if this is a good approach...

Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: applets.diff
Type: text/x-diff
Size: 8062 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20050903/9cff677b/attachment.bin 


More information about the busybox mailing list