[BusyBox] built-in commands problem
Rob Landley
rob at landley.net
Sat Sep 25 03:35:52 UTC 2004
On Friday 24 September 2004 07:16, Doctor Bill wrote:
> It is a mistake to assume /proc will even have been mounted. I can
> think of several solutions, but all of them involve adding more code
> size than anybody would really want for a busy box solution. I
> believe normally programming practice is to first try argv[0], cached
> at startup time, then try searching the path, finally try the /proc
> filesystem.
>
> Worse case scenario, a chroot has been done to a read only disk
> without the executable or /proc filesystem. In that case a user mount
> of /proc on an available directory is about the only solution, but
> most programmers would instead bomb with an error descriptive enough
> so the user would know they needed to somehow mount /proc before
> getting to state next time.
>
> No algorithm is going to work 100% of the time, and one to work
> 99.999% of the time would probably be a library all in itself. So
> start with the simplest, and if that is not good enough add in the
> next simplest until it is "good enough".
>
> Bill
Running a built-in command that fails because proc is not accessable from the
current environment is a totally separate problem from being unable to run
the command at all due to a chroot orrunning an executable other than
/bin/busybox in the first place.
In general, a command that barfs because it can't access proc should have some
variant of a decent error message. Maybe we need a bb_must_open( ) or some
such that prints the filename and dies if it can't open it...
That's a totally separate issue from the built-in commands mess.
Rob
--
www.linucon.org: Linux Expo and Science Fiction Convention
October 8-10, 2004 in Austin Texas. (I'm the con chair.)
More information about the busybox
mailing list