[Bug 40483] cmd execute "if foo==bar echo haha1& echo haha2" in a wrong way

wine-bugs at winehq.org wine-bugs at winehq.org
Sat Jul 23 06:30:15 CDT 2016


https://bugs.winehq.org/show_bug.cgi?id=40483

Ziyue Yang <yzylivezh at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yzylivezh at hotmail.com

--- Comment #1 from Ziyue Yang <yzylivezh at 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.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list