[patch] proposed change to busybox option parsing.

Aurelien Jacobs aurel at gnuage.org
Sun Sep 4 20:51:09 UTC 2005


On Sat, 3 Sep 2005 00:56:03 -0500
Rob Landley <rob at landley.net> wrote:

> 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.

IMHO, restricting the busybox executable name to busybox* is not a
very good thing. What if I rename my busybox binary to 'bb' ?
Wouldn't it be better to check if $0 is a symlink to decide if we
are running busybox or an applet ?
Here is the pseudo-code:

if applet $0 is compiled in then
  run applet $0
else
  if $0 is a symlink then
    bail out with unknown applet $0
  else
    run busybox
  fi
fi

Pros: This allows to rename busybox to anything you want except
one of it's applet name.

Cons: There's still problems with :
  cp busybox ls
  ls rm -r /
when busybox is compiled without ls.
But is this a situation that may really happen ? Do people
rename bb to one of it's applet name except for a standalone ash ?
(which is not a problem because `ash rm -r /` has the same effect
as `busybox rm -r /` anyway)

Aurel



More information about the busybox mailing list