[Bug 37478] New: cmd doesn't handle "else if" correctly in all cases

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Oct 29 14:40:59 CDT 2014


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 at winehq.org
          Reporter: jbb.rose at 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

-- 
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