Some new tests and a fix for a bug I hit recently with cmd.exe's handling of PATH.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55097
-- v2: cmd: Fix empty-strings between PATH separators cmd/tests: Add tests for PATH separator
From: Liam Middlebrook lmiddlebrook@nvidia.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55097
Signed-off-by: Liam Middlebrook lmiddlebrook@nvidia.com --- programs/cmd/tests/test_builtins.cmd | 22 ++++++++++++++++++++++ programs/cmd/tests/test_builtins.cmd.exp | 9 +++++++++ 2 files changed, 31 insertions(+)
diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index 3829be50f1a..c13ea923b83 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -3294,6 +3294,28 @@ path try2 path path=try3 path + +echo ------------ Testing PATH Evaluate ------------ +mkdir folder +echo echo I'm here! > folder\sub1.bat + +echo Test normal PATH usage +set path=%cd%\folder +call sub1.bat + +echo Test PATH usage with leading semicolon +set path=;%cd%\folder +call sub1.bat + +echo Test PATH usage with fallback path +set path=%cd%;%cd%\folder +call sub1.bat + +echo Test PATH usage with double semicolon +set path=%cd%;;%cd%\folder +call sub1.bat + +del folder\sub1.bat set path=%WINE_backup_path% set WINE_backup_path=
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index 437ded18000..91570a7990f 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -1680,6 +1680,15 @@ Finished PATH=original PATH=try2 PATH=try3 +------------ Testing PATH Evaluate ------------ +Test normal PATH usage +I'm here!@space@ +Test PATH usage with leading semicolon +I'm here!@space@ +Test PATH usage with fallback path +I'm here!@space@ +Test PATH usage with double semicolon +I'm here!@space@ ------------ Testing start /W ------------ start /W seems to really wait ------------ Testing changing the drive letter ----------
From: Liam Middlebrook lmiddlebrook@nvidia.com
Previously if an empty-string was encountered while parsing out PATH, cmd.exe would ignore the rest of the PATH entirely.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55097
Signed-off-by: Liam Middlebrook lmiddlebrook@nvidia.com --- programs/cmd/wcmdmain.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 022ff6637c5..de6e721b26a 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -1135,6 +1135,12 @@ void WCMD_run_program (WCHAR *command, BOOL called) else lstrcpyW(temp, thisDir + 1);
+ /* When temp is an empty string, skip over it. This needs + to be done before the expansion, because WCMD_get_fullpath + fails when given an empty string */ + if (*temp == '\0') + continue; + /* Since you can have eg. .... on the path, need to expand to full information */ if (!WCMD_get_fullpath(temp, ARRAY_SIZE(thisDir), thisDir, NULL)) return;
one nickpit, at the end of the added tests, 'folder' sub-directory is likely to be removed
On Tue Jun 20 19:06:51 2023 +0000, **** wrote:
Marvin replied on the mailing list:
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=133985 Your paranoid android. === w7u_2qxl (32 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w7u_adm (32 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w7u_el (32 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w8 (32 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w8adm (32 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w864 (32 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w1064v1507 (32 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w1064v1809 (32 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w1064_tsign (32 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w10pro64 (32 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w11pro64 (32 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w7pro64 (64 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w864 (64 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w1064v1507 (64 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w1064v1809 (64 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w1064_2qxl (64 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w1064_adm (64 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w1064_tsign (64 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w10pro64 (64 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w10pro64_en_AE_u8 (64 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w10pro64_ar (64 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w10pro64_ja (64 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w10pro64_zh_CN (64 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === w11pro64_amd (64 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === debian11 (32 bit report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === debian11 (32 bit ar:MA report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === debian11 (32 bit de report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === debian11 (32 bit fr report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === debian11 (32 bit he:IL report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === debian11 (32 bit hi:IN report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === debian11 (32 bit ja:JP report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === debian11 (32 bit zh:CN report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === debian11b (32 bit WoW report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!') === debian11b (64 bit WoW report) === cmd.exe: batch.c:313: Test failed: excess characters on line 1685 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1687 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1689 (got 'I'm here! ', wanted 'I'm here!') batch.c:313: Test failed: excess characters on line 1691 (got 'I'm here! ', wanted 'I'm here!')
Fixed in v2
On Tue Jun 20 20:14:08 2023 +0000, eric pouech wrote:
one nickpit, at the end of the added tests, 'folder' sub-directory is likely to be removed
Thanks for catching that, I'll add that in.