From: Vijay Kiran Kamuju infyquest@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55662 --- programs/cmd/builtins.c | 2 +- programs/cmd/tests/test_builtins.cmd | 14 +++++++++++--- programs/cmd/tests/test_builtins.cmd.exp | 5 ++++- 3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 708e3c6dce6..d3182be99ea 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -3161,7 +3161,7 @@ void WCMD_setshow_env (WCHAR *s) { if (string[count-2] == '\r') string[count-2] = '\0'; /* Under Windoze we get CRLF! */ WINE_TRACE("set /p: Setting var '%s' to '%s'\n", wine_dbgstr_w(s), wine_dbgstr_w(string)); - SetEnvironmentVariableW(s, string); + if(wcslen(string)) SetEnvironmentVariableW(s, string); }
/* See if /A supplied, and if so calculate the results of all the expressions */ diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index d31cb3ef72a..82905f0cbd4 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -1727,8 +1727,8 @@ for %%i in (test) do ( ) echo d4 ) -echo --- set /a -goto :testseta +echo --- set +goto :testset
Rem Ideally for /f can be used rather than building a command to execute rem but that does not work on NT4 @@ -1747,9 +1747,17 @@ goto :checkenvvars %* goto :eof
-:testseta +:testset rem No output when using "set expr" syntax, unless in interactive mode rem Need to use "set envvar=expr" to use in a batch script +echo ------ interactive operations +set WINE_foo=test +echo wine> foo +set /p WINE_foo="prompt>" < NUL +call :checkenvvars WINE_foo test +set /p WINE_foo="prompt>" < foo +call :checkenvvars WINE_foo wine +del foo echo ------ individual operations set WINE_foo=0 set /a WINE_foo=1 +2 & call :checkenvvars WINE_foo 3 diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index c2dba03b740..68ca52925cb 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -1122,7 +1122,10 @@ d3 a4 c4 d4 ---- set /a +--- set +------ interactive operations +"prompt>" WINE_foo correctly test +"prompt>" WINE_foo correctly wine ------ individual operations WINE_foo correctly 3 WINE_foo correctly -1