https://bugs.winehq.org/show_bug.cgi?id=47071
Bug ID: 47071 Summary: Nest or mixed "FOR" and "IF" command sometimes get different result in Wine and Windows. Product: Wine Version: 3.0 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: cmd Assignee: wine-bugs@winehq.org Reporter: mzidbh@hotmail.com Distribution: ---
Created attachment 64257 --> https://bugs.winehq.org/attachment.cgi?id=64257 batch files and snapshots of execution result
The Wine's command interpreter seems to ...
1. could not pair "IF" and "ELSE" correctly. ( Case 1 4 )
2. would ignore scripts after inner "ELSE". ( Case 2 3 )
Case 1 ======================================== @ECHO OFF ECHO FOR in IF 01 :
IF 1 EQU 1 ( FOR %%A IN (1,1) DO ( ECHO A=%%A ) ) ELSE ( ECHO This line should NOT be executed. ) ECHO This line should be executed.
EXIT /B ---------------------------------------- Result in WINE 3.0 ---------------------------------------- FOR in IF 01 : A=1 A=1 Can't recognize 'ELSE ' as an internal or external command, or batch script. This line should NOT be executed. This line should be executed. ---------------------------------------- Result in Windows 7 ---------------------------------------- FOR in IF 01 : A=1 A=1 This line should be executed. ========================================
Case 2 ======================================== @ECHO OFF ECHO IF in FOR 01 :
FOR %%A IN (1,1) DO ( IF 1 EQU 1 ( ECHO This line should be executed. [No.1] ) ELSE ( ECHO This line should NOT be executed. ) ECHO This line should be executed. [No.2] )
EXIT /B ---------------------------------------- Result in WINE 3.0 ---------------------------------------- IF in FOR 01 : This line should be executed. [No.1] This line should be executed. [No.1] ---------------------------------------- Result in Windows 7 ---------------------------------------- IF in FOR 01 : This line should be executed. [No.1] This line should be executed. [No.2] This line should be executed. [No.1] This line should be executed. [No.2] ========================================
Case 3 ======================================== @ECHO OFF ECHO IF in IF 01 :
IF 1 EQU 1 ( IF 1 EQU 1 ( ECHO This line should be executed. [No.1] ) ELSE ( ECHO This line should NOT be executed. [No.1] ) ECHO This line should be executed. [No.2] ) ELSE ( ECHO This line should NOT be executed. [No.2] )
EXIT /B ---------------------------------------- Result in WINE 3.0 ---------------------------------------- IF in IF 01 : This line should be executed. [No.1] ---------------------------------------- Result in Windows 7 ---------------------------------------- IF in IF 01 : This line should be executed. [No.1] This line should be executed. [No.2] ========================================
Case 4 ======================================== @ECHO OFF ECHO IF in IF 04 :
IF 4 EQU 4 ( IF 4 EQU 5 CALL :Label1 ECHO This line should be executed. [No.1] ) ELSE ( ECHO This line should NOT be executed. [No.2] ) GOTO :Label2
:Label1 ECHO This line should NOT be executed. [No.1] GOTO :EOF
:Label2 EXIT /B ---------------------------------------- Result in WINE 3.0 ---------------------------------------- IF in IF 04 : This line should NOT be executed. [No.2] ---------------------------------------- Result in Windows 7 ---------------------------------------- IF in IF 04 : This line should be executed. [No.1] ========================================