[Bug 35412] wine's cmd fails on if not exist foo\nul

WineHQ Bugzilla wine-bugs at winehq.org
Wed Dec 25 01:44:26 CST 2019


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

Jeff Zaroyko <jeffz at jeffz.name> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Jeff Zaroyko <jeffz at jeffz.name> ---
> if not exist libtcc\nul mkdir libtcc

To cut to the heart of the issue, old batch interpreter (like Win98) won't
return true for a directory that exists unless \nul is appended.   Newer
versions, like command.com or cmd.exe on Win XP are not affected.


Here's the testcase to clarify the expected behaviour:

```
mkdir test
if exist test echo yes it exists
if exist test\nul echo yes it exists
rmdir test
if exist test echo yes it exists
if exist test\nul echo yes it exists
```


Expected output from Windows XP:
```
Z:\>mkdir test 

Z:\>if exist test echo yes it exists 
yes it exists

Z:\>if exist test\nul echo yes it exists 
yes it exists

Z:\>rmdir test 

Z:\>if exist test echo yes it exists 

Z:\>if exist test\nul echo yes it exists 
```

Unexpected output from wine-2.4.3 (repro the original bug):
```

c:\>mkdir test 

c:\>if exist test echo yes it exists 
yes it exists

c:\>if exist test\nul echo yes it exists 
yes it exists

c:\>rmdir test 

c:\>if exist test echo yes it exists 

c:\>if exist test\nul echo yes it exists 
yes it exists
```

Issue shown above: Wine is always returning true when \nul is used.


Win98 for reference:
```
c:\>mkdir test 

c:\>if exist test echo yes it exists 

c:\>if exist test\nul echo yes it exists 
yes it exists

c:\>rmdir test 

c:\>if exist test echo yes it exists 

c:\>if exist test\nul echo yes it exists 
```




In wine-5.0-rc2, the issue is fixed.  The output matches XP:

```
c:\>mkdir test

c:\>if exist test echo yes it exists
yes it exists

c:\>if exist test\nul echo yes it exists
yes it exists

c:\>rmdir test

c:\>if exist test echo yes it exists

c:\>if exist test\nul echo yes it exists
```

Marking fixed.

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