diff options
author | Ron Yorston <rmy@pobox.com> | 2015-06-05 14:55:45 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2015-06-05 15:41:40 +0100 |
commit | 0ccf7a03aa45889993716581d675616db633ed33 (patch) | |
tree | bea4cc3a2d5e10575f60b60ff647daf06a433ebb | |
parent | 57e14f8704700ee39855698238d7e397e770332d (diff) | |
download | busybox-w32-0ccf7a03aa45889993716581d675616db633ed33.tar.gz busybox-w32-0ccf7a03aa45889993716581d675616db633ed33.tar.bz2 busybox-w32-0ccf7a03aa45889993716581d675616db633ed33.zip |
ash: add winxp option
In some circumstances Windows XP and Windows Server 2003 seem to dislike
environment variables with backslashes in paths.
The 'winxp' option prevents BusyBox from changing backslashes to slashes
in the environment. Although the option can be managed by the 'set'
builtin it only works if '-X' is given as the first argument to the shell.
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | shell/ash.c | 19 |
2 files changed, 14 insertions, 6 deletions
@@ -18,3 +18,4 @@ Then just `make`. | |||
18 | - Don't do wild things with Windows drive or UNC notation. | 18 | - Don't do wild things with Windows drive or UNC notation. |
19 | - Wildcard expansion is disabled by default, though it can be turned on at compile time. This only affects command line arguments to the binary: the BusyBox shell has full support for wildcards. | 19 | - Wildcard expansion is disabled by default, though it can be turned on at compile time. This only affects command line arguments to the binary: the BusyBox shell has full support for wildcards. |
20 | - Handling of users, groups and permissions is totally bogus. The system only admits to knowing about the current user and always returns the same hardcoded uid, gid and permission values. | 20 | - Handling of users, groups and permissions is totally bogus. The system only admits to knowing about the current user and always returns the same hardcoded uid, gid and permission values. |
21 | - Windows XP and Windows Server 2003 don't seem to like how busybox-w32 handles environment variables. The -X shell option (which must be the first argument) might help. | ||
diff --git a/shell/ash.c b/shell/ash.c index 0d188e1e6..afa9f271b 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -297,6 +297,7 @@ static const char *const optletters_optnames[] = { | |||
297 | #endif | 297 | #endif |
298 | #if ENABLE_PLATFORM_MINGW32 | 298 | #if ENABLE_PLATFORM_MINGW32 |
299 | ,"\0" "noconsole" | 299 | ,"\0" "noconsole" |
300 | ,"X" "winxp" | ||
300 | #endif | 301 | #endif |
301 | }; | 302 | }; |
302 | 303 | ||
@@ -380,6 +381,7 @@ struct globals_misc { | |||
380 | #endif | 381 | #endif |
381 | #if ENABLE_PLATFORM_MINGW32 | 382 | #if ENABLE_PLATFORM_MINGW32 |
382 | # define noconsole optlist[14 + ENABLE_ASH_BASH_COMPAT + 2*DEBUG] | 383 | # define noconsole optlist[14 + ENABLE_ASH_BASH_COMPAT + 2*DEBUG] |
384 | # define winxp optlist[15 + ENABLE_ASH_BASH_COMPAT + 2*DEBUG] | ||
383 | #endif | 385 | #endif |
384 | 386 | ||
385 | /* trap handler commands */ | 387 | /* trap handler commands */ |
@@ -13453,7 +13455,11 @@ exitshell(void) | |||
13453 | } | 13455 | } |
13454 | 13456 | ||
13455 | static void | 13457 | static void |
13458 | #if ENABLE_PLATFORM_MINGW32 | ||
13459 | init(int xp) | ||
13460 | #else | ||
13456 | init(void) | 13461 | init(void) |
13462 | #endif | ||
13457 | { | 13463 | { |
13458 | /* from input.c: */ | 13464 | /* from input.c: */ |
13459 | /* we will never free this */ | 13465 | /* we will never free this */ |
@@ -13502,8 +13508,7 @@ init(void) | |||
13502 | struct passwd *pw; | 13508 | struct passwd *pw; |
13503 | 13509 | ||
13504 | for (envp = environ; envp && *envp; envp++) { | 13510 | for (envp = environ; envp && *envp; envp++) { |
13505 | end = strchr(*envp, '='); | 13511 | if (!(end=strchr(*envp, '='))) |
13506 | if (!end) | ||
13507 | continue; | 13512 | continue; |
13508 | 13513 | ||
13509 | /* make all variable names uppercase */ | 13514 | /* make all variable names uppercase */ |
@@ -13511,9 +13516,11 @@ init(void) | |||
13511 | *start = toupper(*start); | 13516 | *start = toupper(*start); |
13512 | 13517 | ||
13513 | /* convert backslashes to forward slashes */ | 13518 | /* convert backslashes to forward slashes */ |
13514 | for ( ++end; *end; ++end ) { | 13519 | if (!xp) { |
13515 | if ( *end == '\\' ) { | 13520 | for ( ++end; *end; ++end ) { |
13516 | *end = '/'; | 13521 | if ( *end == '\\' ) { |
13522 | *end = '/'; | ||
13523 | } | ||
13517 | } | 13524 | } |
13518 | } | 13525 | } |
13519 | } | 13526 | } |
@@ -13739,7 +13746,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv) | |||
13739 | #endif | 13746 | #endif |
13740 | rootpid = getpid(); | 13747 | rootpid = getpid(); |
13741 | 13748 | ||
13742 | init(); | 13749 | init(IF_PLATFORM_MINGW32(argc >= 2 && strcmp(argv[1], "-X") == 0)); |
13743 | setstackmark(&smark); | 13750 | setstackmark(&smark); |
13744 | 13751 | ||
13745 | #if ENABLE_PLATFORM_MINGW32 | 13752 | #if ENABLE_PLATFORM_MINGW32 |