When /proc isn't mounted, the /proc/self/exe exec will fail. In that
case, busybox should probably just fall back to the normal $PATH
behavior instead of failing. (PREFER
I thought this would be a quick two or three line tweak to the one exec
wrapper, but a grep of the source for FEATURE_PREFER_APPLETS produced 26
hits. More than a page. It scrolled off the top of my screen.
It's in applets/applet_tables.c, libbb/xfunc_die.c,
libbb/vfork_daemon_rexec.c, libbb/fflush_stdout_and_exit.c,
libbb/find_pid_by_name.c, libbb/execable.c, include/busybox.h,
include/libbb.h, two different config.in files, and there are TEST files
sprinkled all over the tree. It's even in the INSTALL documentation for
some strange reason.
This thing has bloated out of control and I no longer even pretend to
understand it. I just thought I'd pass on the feature suggestion.
I did dig a bit, by the way. In libbb/execable.c (what kind of name is
that?)
#if ENABLE_FEATURE_PREFER_APPLETS
/* just like the real execvp, but try to launch an applet named 'file' first
*/
int FAST_FUNC bb_execvp(const char *file, char *const argv[])
{
return execvp(find_applet_by_name(file) >= 0 ?
bb_busybox_exec_path : file,
argv);
}
#endif
Define "first"? That attempts to exec exactly one thing, with no fallback.
And while we're at it:
#if ENABLE_FEATURE_PREFER_APPLETS
int bb_execvp(const char *file, char *const argv[]) FAST_FUNC;
#define BB_EXECVP(prog,cmd) bb_execvp(prog,cmd)
#define BB_EXECLP(prog,cmd,...) \
execlp((find_applet_by_name(prog) >= 0) ?
CONFIG_BUSYBOX_EXEC_PATH : prog, \
cmd, __VA_ARGS__)
#else
#define BB_EXECVP(prog,cmd) execvp(prog,cmd)
#define BB_EXECLP(prog,cmd,...) execlp(prog,cmd, __VA_ARGS__)
#endif
Thats an abomination. The only user of bb_execvp() is that macro. So
you create an unnecessary wrapper (inside an #ifdef) which you then
rename with a macro (inside an #ifdef, just so the #ifdef occurs twice).
In one of them, you have a function wrapper. Write next to it, ou're
doing the wrapping in the macro. There is NO REASON FOR ANY OF THIS.
This is about the point at which I decided I wasn't going to touch this
house of cards.
Rob
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox