From 52922a1509d4623b7efdc8e7091be514cf4cd261 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Mon, 28 Aug 2023 09:47:51 +0100 Subject: libbb: fix #!/bin/busybox Commit 3476fb9f4c (ps: display interpreted script name in comm column) required the applet start up code to detect the index of the script in a shebang command line. When a script starts with '#!/bin/busybox' the argument list is shifted in busybox_main() but the script index wasn't adjusted to match. This caused the command to fail. Make the proper adjustment. Add 16 bytes. (GitHub issue #357) --- libbb/appletlib.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 8801c732d..bf9ae4603 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c @@ -1113,6 +1113,10 @@ int busybox_main(int argc UNUSED_PARAM, char **argv) /* We support "busybox /a/path/to/applet args..." too. Allows for * "#!/bin/busybox"-style wrappers */ +# if ENABLE_PLATFORM_MINGW32 + if (interp) + --interp; +# endif applet_name = bb_get_last_path_component_nostrip(argv[0]); } run_applet_and_exit(applet_name, argv); -- cgit v1.2.3-55-g6feb