From: Haidong Yu yuhaidong@uniontech.com
Signed-off-by: Haidong Yu yuhaidong@uniontech.com --- programs/cmd/tests/test_cmdline.cmd | 51 ++++++++++++++++++++++++- programs/cmd/tests/test_cmdline.cmd.exp | 16 ++++++++ 2 files changed, 66 insertions(+), 1 deletion(-)
diff --git a/programs/cmd/tests/test_cmdline.cmd b/programs/cmd/tests/test_cmdline.cmd index 8712f05f87d..23584e952fc 100644 --- a/programs/cmd/tests/test_cmdline.cmd +++ b/programs/cmd/tests/test_cmdline.cmd @@ -240,6 +240,55 @@ call say' echo @echo ~ > "say~.bat" call say~
+echo --------- Testing batch with keywords filename -------------- +echo @echo start > start.bat +echo start.bat > test.bat +call test.bat + +echo @echo for > for.bat +echo for.bat > test.bat +call test.bat + +echo @echo more > more.bat +echo more.bat > test.bat +call test.bat + +echo @echo . > echo.bat +echo echo.bat bar > test.bat +call test.bat +del echo.bat +echo.bat + +echo @echo . > .bat +echo .bat > test.bat +call test.bat + +echo @echo echo+ > echo+.bat +echo echo+.bat > test.bat +call test.bat +echo echo+ bar> test.bat +call test.bat +del echo+.bat +call test.bat + +echo @echo echo_ > echo_.bat +echo echo_.bat > test.bat +call test.bat +echo echo_ bar > test.bat +call test.bat + +echo @echo + > +.bat +echo +.bat > test.bat +call test.bat +echo + > test.bat +call test.bat + +echo @echo _ > _.bat +echo _.bat > test.bat +call test.bat +echo _ > test.bat +call test.bat + echo --------- Testing parameter passing -------------- echo @echo 1:%%1,2:%%2 > tell.bat call tell 1 @@ -278,7 +327,7 @@ call tell(1234) call tell(12(34) call tell(12;34) echo --------- Finished -------------- -del tell.bat say*.* bazbaz*.bat +del tell.bat say*.* bazbaz*.bat start.bat test.bat for.bat more.bat echo.bat .bat echo+.bat echo_.bat +.bat _.bat exit :setError exit /B %1 diff --git a/programs/cmd/tests/test_cmdline.cmd.exp b/programs/cmd/tests/test_cmdline.cmd.exp index 946e353fcf3..b8b344c9b1f 100644 --- a/programs/cmd/tests/test_cmdline.cmd.exp +++ b/programs/cmd/tests/test_cmdline.cmd.exp @@ -121,6 +121,22 @@ bar@space@ 0@space@ '@space@ ~@space@ +--------- Testing batch with keywords filename -------------- +start@space@ +for@space@ +more@space@ +.@space@ +bat@space@ +.@space@ +echo+@space@ +echo+@space@ +@space@bar@space@ +echo_@space@ +echo_@space@ ++@space@ ++@space@ +_@space@ +_@space@ --------- Testing parameter passing -------------- 1:1,2:@space@ 1:(1),2:@space@
From: Haidong Yu yuhaidong@uniontech.com
Signed-off-by: Haidong Yu yuhaidong@uniontech.com --- programs/cmd/builtins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index ca703af52ec..92c5762a5ef 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -1485,7 +1485,7 @@ void WCMD_echo (const WCHAR *args) const WCHAR *origcommand = args; WCHAR *trimmed;
- if ( args[0]==' ' || args[0]=='\t' || args[0]=='.' + if ( args[0]==' ' || args[0]=='\t' || args[0]=='.' || args[0]=='+' || args[0]==':' || args[0]==';' || args[0]=='/') args++;
From: Haidong Yu yuhaidong@uniontech.com
Signed-off-by: Haidong Yu yuhaidong@uniontech.com --- programs/cmd/wcmdmain.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 1867c5afb92..8fa2c82a279 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -1302,6 +1302,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects, STD_OUTPUT_HANDLE, STD_ERROR_HANDLE}; BOOL prev_echo_mode, piped = FALSE; + BOOL called = FALSE;
WINE_TRACE("command on entry:%s (%p)\n", wine_dbgstr_w(command), cmdList); @@ -1327,8 +1328,17 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects, } for (i=0; i<=WCMD_EXIT; i++) { if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT, - whichcmd, count, inbuilt[i], -1) == CSTR_EQUAL) break; + whichcmd, count, inbuilt[i], -1) == CSTR_EQUAL) { + called = TRUE; + break; + } + } + + while (!retrycall && (IsCharAlphaNumericW(whichcmd[count]) || wcschr(L".+_", whichcmd[count]))) { + count++; + i = WCMD_EXIT + 1; } + cmd_index = i; parms_start = WCMD_skip_leading_spaces (&whichcmd[count]);
@@ -1646,7 +1656,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects, /* else: drop through */ default: prev_echo_mode = echo_mode; - WCMD_run_program (whichcmd, FALSE); + WCMD_run_program (whichcmd, called); echo_mode = prev_echo_mode; } free(cmd);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=143744
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w7u_adm (32 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w7u_el (32 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w8 (32 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w8adm (32 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w864 (32 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w1064v1507 (32 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w1064v1809 (32 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w1064_tsign (32 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w10pro64 (32 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w10pro64_en_AE_u8 (32 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w11pro64 (32 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w7pro64 (64 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w864 (64 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w1064v1507 (64 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w1064v1809 (64 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w1064_2qxl (64 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w1064_adm (64 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w1064_tsign (64 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w10pro64 (64 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w10pro64_ar (64 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w10pro64_ja (64 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w10pro64_zh_CN (64 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== w11pro64_amd (64 bit report) ===
cmd.exe: batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== debian11 (32 bit report) ===
cmd.exe: batch.c:136: Test failed: CreateFile failed: 00000020 batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== debian11 (32 bit ar:MA report) ===
cmd.exe: batch.c:136: Test failed: CreateFile failed: 00000020 batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== debian11 (32 bit de report) ===
cmd.exe: batch.c:136: Test failed: CreateFile failed: 00000020 batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== debian11 (32 bit fr report) ===
cmd.exe: batch.c:136: Test failed: CreateFile failed: 00000020 batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== debian11 (32 bit he:IL report) ===
cmd.exe: batch.c:136: Test failed: CreateFile failed: 00000020 batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== debian11 (32 bit hi:IN report) ===
cmd.exe: batch.c:136: Test failed: CreateFile failed: 00000020 batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== debian11 (32 bit ja:JP report) ===
cmd.exe: batch.c:136: Test failed: CreateFile failed: 00000020 batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== debian11 (32 bit zh:CN report) ===
cmd.exe: batch.c:136: Test failed: CreateFile failed: 00000020 batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== debian11b (32 bit WoW report) ===
cmd.exe: batch.c:136: Test failed: CreateFile failed: 00000020 batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
=== debian11b (64 bit WoW report) ===
cmd.exe: batch.c:136: Test failed: CreateFile failed: 00000020 batch.c:310: Test failed: unexpected end of line 129 (got 'bat', wanted 'bat@space@') batch.c:310: Test failed: unexpected end of line 133 (got ' bar', wanted '@space@bar@space@')
sorry for the delay, I fought I did comment on this version... This still doesn't work as expected as
echo
when echo.bat is present will call echo.bat, whereas the builtin command shall be used.
when we have <cmd>.bat... be should first try to run_program() on the whole command; and no program is found, then, fall back to builtin cmd (and .bat becomes a parameter)