Regression introduced in f238e846e701d2039eceb51f2f6e9d936f8c791c. Therefore if conditions got influenced by values of the previous line.
v3: Unchanged, but patchwatcher did not run tests last time. Supersedes 184644
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47770 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48738 Signed-off-by: Bernhard Übelacker bernhardu@mailbox.org --- programs/cmd/builtins.c | 6 ++++++ programs/cmd/wcmdmain.c | 15 +++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 1870e5688da..70ccddebc11 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -2938,9 +2938,15 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList) int test; /* Condition evaluation result */ WCHAR *command;
+ /* Function evaluate_if_condition relies on the global variables quals, param1 and param2 + set in a call to WCMD_parse before */ if (evaluate_if_condition(p, &command, &test, &negate) == -1) goto syntax_err;
+ WINE_TRACE("p: %s, quals: %s, param1: %s, param2: %s, command: %s\n", + wine_dbgstr_w(p), wine_dbgstr_w(quals), wine_dbgstr_w(param1), + wine_dbgstr_w(param2), wine_dbgstr_w(command)); + /* Process rest of IF statement which is on the same line Note: This may process all or some of the cmdList (eg a GOTO) */ WCMD_part_execute(cmdList, command, TRUE, (test != negate)); diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 2819f7fa99f..16843e40873 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -1947,8 +1947,6 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE To be able to handle ('s in the condition part take as much as evaluate_if_condition would take and skip parsing it here. */ } else if (WCMD_keyword_ws_found(ifCmd, ARRAY_SIZE(ifCmd), curPos)) { - static const WCHAR parmI[] = {'/','I','\0'}; - static const WCHAR notW[] = {'n','o','t','\0'}; int negate; /* Negate condition */ int test; /* Condition evaluation result */ WCHAR *p, *command; @@ -1956,17 +1954,18 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE inIf = TRUE;
p = curPos+(ARRAY_SIZE(ifCmd)); - while (*p == ' ' || *p == '\t') { + while (*p == ' ' || *p == '\t') p++; - if (lstrcmpiW(WCMD_parameter(p, 0, NULL, TRUE, FALSE), notW) == 0) - p += lstrlenW(notW); - if (lstrcmpiW(WCMD_parameter(p, 0, NULL, TRUE, FALSE), parmI) == 0) - p += lstrlenW(parmI); - } + WCMD_parse (p, quals, param1, param2);
+ /* Function evaluate_if_condition relies on the global variables quals, param1 and param2 + set in a call to WCMD_parse before */ if (evaluate_if_condition(p, &command, &test, &negate) != -1) { int if_condition_len = command - curPos; + WINE_TRACE("p: %s, quals: %s, param1: %s, param2: %s, command: %s, if_condition_len: %d\n", + wine_dbgstr_w(p), wine_dbgstr_w(quals), wine_dbgstr_w(param1), + wine_dbgstr_w(param2), wine_dbgstr_w(command), if_condition_len); memcpy(&curCopyTo[*curLen], curPos, if_condition_len*sizeof(WCHAR)); (*curLen)+=if_condition_len; curPos+=if_condition_len;
This demonstrates a possible crash caused by a regression, that should be fixed by patch [1/2].
v3: Unchanged, but patchwatcher did not run tests last time. Supersedes 184645
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47770 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48738 Signed-off-by: Bernhard Übelacker bernhardu@mailbox.org --- programs/cmd/tests/test_builtins.cmd | 7 +++++++ programs/cmd/tests/test_builtins.cmd.exp | 2 ++ 2 files changed, 9 insertions(+)
diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index 4bf37a35bb8..73b0917c275 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -1013,6 +1013,13 @@ if /i not (a)==(b) ( ) else ( echo comparison operators surrounded by brackets seem to be broken ) +if defined windir echo windir is defined +if not defined windir echo windir is defined +if not exist %windir% ( + echo windir does not exist +) else ( + echo windir does exist +) echo --- case sensitivity with and without /i option if bar==BAR echo if does not default to case sensitivity if not bar==BAR echo if seems to default to case sensitivity diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index 5bcd29b917c..fb84de2f5d5 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -699,6 +699,8 @@ comparison operators surrounded by brackets seem to work comparison operators surrounded by brackets seem to work comparison operators surrounded by brackets seem to work comparison operators surrounded by brackets seem to work +windir is defined +windir does exist --- case sensitivity with and without /i option if seems to default to case sensitivity if /i seems to work
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=71064
Your paranoid android.
=== w1064v1809_ar (32 bit report) ===
cmd.exe: batch.c:321: Test failed: unexpected char 0x47 position 0 in line 981 (got 'Got unexpected result: "C:\Users\winetest\Documents\foobar\pop."', wanted 'Plain directory enumeration from provided root') batch.c:321: Test failed: unexpected char 0x50 position 0 in line 982 (got 'Plain directory enumeration from provided root', wanted 'File enumeration') batch.c:310: Test failed: unexpected end of line 983 (got 'File enumeration', wanted 'File enumeration from provided root') batch.c:321: Test failed: unexpected char 0x46 position 0 in line 984 (got 'File enumeration from provided root', wanted 'Mixed enumeration') batch.c:310: Test failed: unexpected end of line 985 (got 'Mixed enumeration', wanted 'Mixed enumeration from provided root') batch.c:321: Test failed: unexpected char 0x4d position 0 in line 986 (got 'Mixed enumeration from provided root', wanted 'With duplicates enumeration') batch.c:321: Test failed: unexpected char 0x57 position 0 in line 987 (got 'With duplicates enumeration', wanted 'Strip missing wildcards, keep unwildcarded names') batch.c:321: Test failed: unexpected char 0x53 position 0 in line 988 (got 'Strip missing wildcards, keep unwildcarded names', wanted 'for /R passed') batch.c:321: Test failed: unexpected char 0x66 position 0 in line 989 (got 'for /R passed', wanted '--- Complex wildcards unix and windows slash')