https://bugs.winehq.org/show_bug.cgi?id=40483
Bug ID: 40483 Summary: cmd execute "if foo==bar echo haha1& echo haha2" in a wrong way Product: Wine Version: 1.9.8 Hardware: x86 OS: Linux Status: NEW Severity: normal Priority: P2 Component: cmd Assignee: wine-bugs@winehq.org Reporter: fracting@gmail.com Distribution: ---
Step to reproduce"
Run the below command line in cmd console:
if foo==bar echo haha1& echo haha2
Expect result: On windows, the command prints nothing
Actual result: On Wine, the command prints "haha2"
This makes latest MSYS2 fails.
https://bugs.winehq.org/show_bug.cgi?id=40483
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |austinenglish@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=40483
Ziyue Yang yzylivezh@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |yzylivezh@hotmail.com
--- Comment #1 from Ziyue Yang yzylivezh@hotmail.com --- It seems that once the '&' character is hit, the program take the whole substring before '&' as a new command.
As a result the "if foo==bar echo haha1& echo haha2" command is parsed as (if foo==bar echo haha1) & (echo haha2).
The problem is that the precedence of "if" is higher, and the test command should be parsed as
if foo==bar (echo haha1& echo haha2)
The whole command cannot be put into WCMD_if function directly for the "echo haha1& echo haha2" part would be parsed as a single command. However the origin command should be parsed as the following group of commands:
if foo==bar echo haha1 echo haha2
On the other hand, since WCMD_ReadAndParseLine doesn't deal with "if" parsing right now, it's impossible to parse the command correctly in this function without changing it a lot...
I'm thinking of detecting "if" condition in WCMD_ReadAndParseLine using the "inIf" flag.
https://bugs.winehq.org/show_bug.cgi?id=40483
Carlos Rafael Ramirez crramirez@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |crramirez@gmail.com
--- Comment #2 from Carlos Rafael Ramirez crramirez@gmail.com --- Duplicate of https://bugs.winehq.org/show_bug.cgi?id=33636
https://bugs.winehq.org/show_bug.cgi?id=40483
winetest@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |winetest@luukku.com
https://bugs.winehq.org/show_bug.cgi?id=40483
winetest@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dimesio@earthlink.net
https://bugs.winehq.org/show_bug.cgi?id=40483
--- Comment #3 from winetest@luukku.com --- (In reply to Carlos Rafael Ramirez from comment #2)
Duplicate of https://bugs.winehq.org/show_bug.cgi?id=33636
Wasnt that other bug fixed with the commit(s)?
https://bugs.winehq.org/show_bug.cgi?id=40483
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |DUPLICATE
--- Comment #4 from Bruno Jesus 00cpxxx@gmail.com --- (In reply to Carlos Rafael Ramirez from comment #2)
Duplicate of https://bugs.winehq.org/show_bug.cgi?id=33636
Indeed, thanks.
*** This bug has been marked as a duplicate of bug 33636 ***
https://bugs.winehq.org/show_bug.cgi?id=40483
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Bruno Jesus 00cpxxx@gmail.com --- Closing duplicate bugs.