diff options
author | Ron Yorston <rmy@pobox.com> | 2024-03-26 16:47:14 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-03-26 16:47:14 +0000 |
commit | 9e2482e93913a7de1f667720a7ac619fe6fdd723 (patch) | |
tree | d3a2d4cf188a75d339253ce29704a1091a166762 | |
parent | 1eee84b800408e53e659ff303eaa08ee09d67c3b (diff) | |
download | busybox-w32-9e2482e93913a7de1f667720a7ac619fe6fdd723.tar.gz busybox-w32-9e2482e93913a7de1f667720a7ac619fe6fdd723.tar.bz2 busybox-w32-9e2482e93913a7de1f667720a7ac619fe6fdd723.zip |
ash: strip path from NOFORK applet names
Commit 26ba73098 (win32: search PATH for missing Unix-style
executables) extended the cases in which PATH would be searched
for executables specified with a Unix-style path.
A side effect of this change was to pass the Unix-style path as
argv[0] to NOFORK applets. The 'uname' applet examines argv[0]
to determine how to behave. When invoked as '/bin/uname' it
returned unexpected results. Other applets may be similarly
affected.
When a NOFORK applet is invoked in evalcommand(), strip any path.
Costs 16 bytes.
(GitHub issue #392)
-rw-r--r-- | shell/ash.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index 31d3c1013..d312cb8cd 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -11688,6 +11688,9 @@ evalcommand(union node *cmd, int flags) | |||
11688 | * and/or wait for user input ineligible for NOFORK: | 11688 | * and/or wait for user input ineligible for NOFORK: |
11689 | * for example, "yes" or "rm" (rm -i waits for input). | 11689 | * for example, "yes" or "rm" (rm -i waits for input). |
11690 | */ | 11690 | */ |
11691 | #if ENABLE_PLATFORM_MINGW32 | ||
11692 | argv[0] = (char *)bb_basename(argv[0]); | ||
11693 | #endif | ||
11691 | exitstatus = run_nofork_applet(applet_no, argv); | 11694 | exitstatus = run_nofork_applet(applet_no, argv); |
11692 | environ = sv_environ; | 11695 | environ = sv_environ; |
11693 | /* | 11696 | /* |