# HG changeset patch # User Rob Landley # Date 1413852749 18000 # Node ID ec07449e8e4af2701ef433adff65039e3f58254d # Parent 49410d68ee40cc001c66aa07617bfe41410c3df6 Add TOYBOX_NORECURSE so xexec() won't make internal function calls. diff -r 49410d68ee40 -r ec07449e8e4a Config.in --- a/Config.in Sun Oct 19 12:08:25 2014 -0500 +++ b/Config.in Mon Oct 20 19:52:29 2014 -0500 @@ -71,6 +71,19 @@ without a real OS (ala newlib+libgloss), enable this to make toybox clean up after itself. +config TOYBOX_NORECURSE + bool "Disable recursive execution" + default n + help + When one toybox command calls another, usually it just calls the new + command's main() function rather than searching the $PATH and calling + exec on another file (which is much slower). + + This disables that optimization, so toybox will run external commands + even when it has a built-in version of that command. This requires + toybox symlinks to be installed in the $PATH, or re-invoking the + "toybox" multiplexer command by name. + config TOYBOX_DEBUG bool "Debugging tests" default n @@ -89,5 +102,4 @@ default 500 help When commands like useradd/groupadd allocate user IDs, start here. - endmenu diff -r 49410d68ee40 -r ec07449e8e4a lib/xwrap.c --- a/lib/xwrap.c Sun Oct 19 12:08:25 2014 -0500 +++ b/lib/xwrap.c Mon Oct 20 19:52:29 2014 -0500 @@ -137,7 +137,7 @@ // with a path isn't a builtin, so /bin/sh won't match the builtin sh. void xexec(char **argv) { - if (CFG_TOYBOX) toy_exec(argv); + if (CFG_TOYBOX && !CFG_TOYBOX_NORECURSE) toy_exec(argv); execvp(argv[0], argv); perror_exit("exec %s", argv[0]);