Francesco Noferi : cmd.exe: Fix parsing of && between quotes.

Alexandre Julliard julliard at winehq.org
Tue Mar 23 15:07:40 CDT 2021


Module: wine
Branch: oldstable
Commit: 6fabb4d5acf83279410887204865e0a43fd07186
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6fabb4d5acf83279410887204865e0a43fd07186

Author: Francesco Noferi <lolisamurai at tfwno.gf>
Date:   Fri Sep 11 09:25:48 2020 +0000

cmd.exe: Fix parsing of && between quotes.

Signed-off-by: Francesco Noferi <lolisamurai at tfwno.gf>
Signed-off-by: Myah Caron <qsniyg at protonmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit fc1bb9aff5c5af22819879e98ffab25bc833fb03)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 programs/cmd/tests/test_cmdline.cmd     | 4 ++++
 programs/cmd/tests/test_cmdline.cmd.exp | 3 +++
 programs/cmd/wcmdmain.c                 | 3 ++-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/programs/cmd/tests/test_cmdline.cmd b/programs/cmd/tests/test_cmdline.cmd
index 32a1ef2e48f..54e7da74314 100644
--- a/programs/cmd/tests/test_cmdline.cmd
+++ b/programs/cmd/tests/test_cmdline.cmd
@@ -178,6 +178,10 @@ rem cond 5 - string between quotes must be name of executable
 cmd /c "say five"
 echo @echo 5 >"say five.bat"
 cmd /c "say five"
+rem cond 6 - && between quotes
+cd .&&"cmd.exe" /c "echo hi"
+cd "."&&cmd.exe /c "echo hi"
+cd "."&&"cmd.exe" /c "echo hi"
 
 echo ------- Testing CMD /C qualifier treatment ------------
 rem no need for space after /c
diff --git a/programs/cmd/tests/test_cmdline.cmd.exp b/programs/cmd/tests/test_cmdline.cmd.exp
index 980f67411cb..1e97be86271 100644
--- a/programs/cmd/tests/test_cmdline.cmd.exp
+++ b/programs/cmd/tests/test_cmdline.cmd.exp
@@ -87,6 +87,9 @@ Passed
 2 at space@
 0 at space@
 5 at space@
+hi
+hi
+hi
 ------- Testing CMD /C qualifier treatment ------------
 0 at space@
 1 at space@
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index f6c770c9b8d..609c6f8bd25 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -1782,7 +1782,8 @@ static BOOL WCMD_IsEndQuote(const WCHAR *quote, int quoteIndex)
 
         /* Quote counting ends at EOL, redirection, space or pipe if current quote is complete */
         else if(((quoteCount % 2) == 0)
-            && ((quote[i] == '<') || (quote[i] == '>') || (quote[i] == '|') || (quote[i] == ' ')))
+            && ((quote[i] == '<') || (quote[i] == '>') || (quote[i] == '|') || (quote[i] == ' ') ||
+                (quote[i] == '&')))
         {
             break;
         }




More information about the wine-cvs mailing list