https://bugs.winehq.org/show_bug.cgi?id=37478
Bug ID: 37478 Summary: cmd doesn't handle "else if" correctly in all cases Product: Wine Version: 1.7.28 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: cmd Assignee: wine-bugs@winehq.org Reporter: jbb.rose@yahoo.com Distribution: ---
cmd.exe doesn't seem to handle "else if" constructs correctly in all cases. This is making it difficult for me to run some complex build scripts under wine.
Using this batch file:
C:\Users\bjj\Documents>type try.bat @REM bjj test hack @echo off echo Args: "%1" "%2" "%3" "%4"
if /I "%1" == "DEBUG" ( echo It is debug ) else if /I "%1" == "RELEASE" ( echo It is release ) else if /I "%1" == "TRY" ( echo It is try ) else ( echo it is neither: "%1" )
On Windows 7, all the branches seem to be handled correctly:
C:\Users\bjj\Documents>try foo Args: "foo" "" "" "" it is neither: "foo"
C:\Users\bjj\Documents>try DEBUG Args: "DEBUG" "" "" "" It is debug
C:\Users\bjj\Documents>try RELEASE Args: "RELEASE" "" "" "" It is release
C:\Users\bjj\Documents>try TRY Args: "TRY" "" "" "" It is try
However, on wine 1.7.28 the "else" branch is sometimes executed when it shouldn't be:
W:>try foo Args: "foo" "" "" "" it is neither: "foo"
W:>try DEBUG Args: "DEBUG" "" "" "" It is debug it is neither: "DEBUG"
W:>try RELEASE Args: "RELEASE" "" "" "" It is release it is neither: "RELEASE"
W:>try TRY Args: "TRY" "" "" "" It is try
Judging from this example, it appears that the "else" clause is only skipped if the final "if .. else if ..." clause is true. If one of the earlier clasues is true, the final "else" is unexpectedly executed.
I haven't tried this batch file with earlier versions of wine.
Thanks, Brian
https://bugs.winehq.org/show_bug.cgi?id=37478
Mikhail Bystryantsev ho-rr-or@mail.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ho-rr-or@mail.ru
--- Comment #1 from Mikhail Bystryantsev ho-rr-or@mail.ru --- I have the same problem. Wine 1.7.33
if 1 == 1 ( echo FIRST ) else if 1 == 1 ( echo SECOND ) else ( echo THIRD )
Output: FIRST THIRD
https://bugs.winehq.org/show_bug.cgi?id=37478
Thomas Faller tfaller.dev@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |tfaller.dev@gmail.com
--- Comment #2 from Thomas Faller tfaller.dev@gmail.com --- I've submitted a patch for this issue:
http://source.winehq.org/patches/data/112260
Both examples are fixed.
https://bugs.winehq.org/show_bug.cgi?id=37478
--- Comment #3 from Thomas Faller tfaller.dev@gmail.com --- This issue was fixed by 3cda870469cc457766f677f51afe352285db437b Please can someone mark this bug as RESOLVED FIXED. Thank you.
https://bugs.winehq.org/show_bug.cgi?id=37478
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |3cda870469cc457766f677f51af | |e352285db437b Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED
--- Comment #4 from Bruno Jesus 00cpxxx@gmail.com --- (In reply to Thomas Faller from comment #3)
This issue was fixed by 3cda870469cc457766f677f51afe352285db437b Please can someone mark this bug as RESOLVED FIXED. Thank you.
https://bugs.winehq.org/show_bug.cgi?id=37478
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.7.50.