aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2024-07-07 10:18:54 +0100
committerRon Yorston <rmy@pobox.com>2024-07-07 10:18:54 +0100
commitf4fc4fb51fcba40a5db81861629fff27d73bed85 (patch)
tree9480b772b9ba823f0a7082cfabef7bc5e10370ef
parent480ebf43e85b2cfc31c433ee8bb3a723e44e9f9f (diff)
downloadbusybox-w32-f4fc4fb51fcba40a5db81861629fff27d73bed85.tar.gz
busybox-w32-f4fc4fb51fcba40a5db81861629fff27d73bed85.tar.bz2
busybox-w32-f4fc4fb51fcba40a5db81861629fff27d73bed85.zip
ash: special hack for libtool
Libtool assumes the host environment is MSYS2 and will be confused by Windows-style command switches. The "/c" in "cmd /c" looks like a path, which MSYS2 incorrectly decodes to "c:/". Anticipating this, libtool encodes these calls as "cmd //c" which does not work outside MSYS2. A busybox-w32 patch makes it behave like MSYS2 in just this one case. Adds 88-96 bytes. (GitHub issue #297 and https://github.com/skeeto/w64devkit/issues/50)
-rw-r--r--shell/ash.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index b894a2314..e2dcb0962 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -9142,6 +9142,16 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) const char *cmd, char **argv, c
9142#endif 9142#endif
9143 9143
9144#if ENABLE_PLATFORM_MINGW32 9144#if ENABLE_PLATFORM_MINGW32
9145 /* Workaround for libtool, which assumes the host is an MSYS2
9146 * environment and requires special-case escaping for cmd.exe.
9147 * https://github.com/skeeto/w64devkit/issues/50 */
9148 if (string_array_len(argv) >= 3 &&
9149 strcmp(argv[0], "cmd") == 0 &&
9150 strcmp(argv[1], "//c") == 0 &&
9151 strcmp(argv[2], "echo") == 0) {
9152 argv[1]++; /* drop extra slash */
9153 }
9154
9145 /* cmd was allocated on the stack with room for an extension */ 9155 /* cmd was allocated on the stack with room for an extension */
9146 add_win32_extension((char *)cmd); 9156 add_win32_extension((char *)cmd);
9147 execve(cmd, argv, envp); 9157 execve(cmd, argv, envp);