[Bug 44373] New: cmd's %0 path variables (e.g. %~dp0) don' t match those of Windows (w.r.t. case and quoting)
wine-bugs at winehq.org
wine-bugs at winehq.org
Fri Jan 19 01:34:46 CST 2018
https://bugs.winehq.org/show_bug.cgi?id=44373
Bug ID: 44373
Summary: cmd's %0 path variables (e.g. %~dp0) don't match those
of Windows (w.r.t. case and quoting)
Product: Wine
Version: 3.0-rc6
Hardware: x86
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: cmd
Assignee: wine-bugs at winehq.org
Reporter: ryan.prichard at gmail.com
Distribution: ---
I'm filing this issue at Fabian Maurer's suggestion, after filing
https://bugs.winehq.org/show_bug.cgi?id=44369.
When %0 starts with a quote character, Windows tends to evaluate the %0 path
variables (%~d0, %~p0, ...) strangely. I think the Wine behavior makes more
sense, but it could also make sense to match Windows bug-for-bug.
Test program (you might have to fix up the C:\bin for your machine):
C:\>mkdir Bin
C:\Bin\ShowArg0.Cmd:
@echo [%0] -------------------- [%~d0] [%~p0] [%~n0] [%~x0]
C:\Bin\RunScript.Cmd
@echo off
setlocal
set PATH=C:\bin;%PATH%
cd \
echo --- Wine and Windows roughly do the same thing.
call showarg0
call SHOWARG0
call showarg0.cmd
call SHOWARG0.CMD
call C:\bin\showarg0
call C:\bin\showarg0.cmd
call c:\bin\showarg0.CMD
call showarg0".cmd"
call showarg0."cmd"
call showarg0.c"md"
call s"ho"warg0.cmd
call s"ho"warg0
call "C:\bin\showarg0.cmd"
call "c:\bin\showarg0.CMD"
echo --- Wine and Windows diverge here.
call "showarg0"
call "SHOWARG0"
call "showarg0.cmd"
call "SHOWARG0.CMD"
call "showarg0".cmd
call "sho"warg0.cmd
call "sho"warg0
call "C":\bin\showarg0.cmd
call "C:"\bin\showarg0.cmd
call "C:\"bin\showarg0.cmd
call "c:\"bin\showarg0.CMD
call "C:\bin\showarg0"
(I edited the script output to align the columns.)
Windows behavior (tested on XP and Win10.0.16299.125):
C:\Bin>RunScript
--- Aside from case, Wine and Windows roughly do the same thing.
--- ... Using c:\bin in PATH
[showarg0] ----------------- [c:] [\Bin\] [ShowArg0] [.Cmd]
[SHOWARG0] ----------------- [c:] [\Bin\] [ShowArg0] [.Cmd]
--- ... Using C:\bin in PATH
[showarg0] ----------------- [C:] [\Bin\] [ShowArg0] [.Cmd]
[SHOWARG0] ----------------- [C:] [\Bin\] [ShowArg0] [.Cmd]
[showarg0.cmd] ------------- [C:] [\Bin\] [ShowArg0] [.Cmd]
[SHOWARG0.CMD] ------------- [C:] [\Bin\] [ShowArg0] [.Cmd]
[C:\bin\showarg0] ---------- [C:] [\Bin\] [ShowArg0] [.Cmd]
[C:\bin\showarg0.cmd] ------ [C:] [\Bin\] [ShowArg0] [.Cmd]
[c:\bin\showarg0.CMD] ------ [c:] [\Bin\] [ShowArg0] [.Cmd]
[showarg0".cmd"] ----------- [C:] [\Bin\] [ShowArg0] [.Cmd]
[showarg0."cmd"] ----------- [C:] [\Bin\] [ShowArg0] [.Cmd]
[showarg0.c"md"] ----------- [C:] [\Bin\] [ShowArg0] [.Cmd]
[s"ho"warg0.cmd] ----------- [C:] [\Bin\] [ShowArg0] [.Cmd]
[s"ho"warg0] --------------- [C:] [\Bin\] [ShowArg0] [.Cmd]
["C:\bin\showarg0.cmd"] ---- [C:] [\Bin\] [ShowArg0] [.Cmd]
["c:\bin\showarg0.CMD"] ---- [c:] [\Bin\] [ShowArg0] [.Cmd]
--- Wine and Windows diverge here.
["showarg0"] --------------- [C:] [\] [showarg0] []
["SHOWARG0"] --------------- [C:] [\] [SHOWARG0] []
["showarg0.cmd"] ----------- [C:] [\] [showarg0] [.cmd]
["SHOWARG0.CMD"] ----------- [C:] [\] [SHOWARG0] [.CMD]
["showarg0".cmd] ----------- [C:] [\] [showarg0"] [.cmd]
["sho"warg0.cmd] ----------- [C:] [\] [sho"warg0] [.cmd]
["sho"warg0] --------------- [C:] [\] [sho"warg0] []
["C":\bin\showarg0.cmd] ---- [C:] [\C":\bin\] [showarg0] [.cmd]
["C:"\bin\showarg0.cmd] ---- [C:] [\"\bin\] [showarg0] [.cmd]
["C:\"bin\showarg0.cmd] ---- [C:] [\"bin\] [showarg0] [.cmd]
["c:\"bin\showarg0.CMD] ---- [c:] [\"bin\] [showarg0] [.CMD]
["C:\bin\showarg0"] -------- [C:] [\Bin\] [showarg0] []
Behavior on wine-3.0-rc6:
C:\Bin>RunScript
--- Aside from case, Wine and Windows roughly do the same thing.
--- ... Using c:\bin in PATH
[showarg0] ----------------- [c:] [\bin\] [showarg0] [.CMD]
[SHOWARG0] ----------------- [c:] [\bin\] [SHOWARG0] [.CMD]
--- ... Using C:\bin in PATH
[showarg0] ----------------- [C:] [\bin\] [showarg0] [.CMD]
[SHOWARG0] ----------------- [C:] [\bin\] [SHOWARG0] [.CMD]
[showarg0.cmd] ------------- [C:] [\bin\] [showarg0] [.cmd]
[SHOWARG0.CMD] ------------- [C:] [\bin\] [SHOWARG0] [.CMD]
[C:\bin\showarg0] ---------- [C:] [\bin\] [showarg0] [.CMD]
[C:\bin\showarg0.cmd] ------ [C:] [\bin\] [showarg0] [.cmd]
[c:\bin\showarg0.CMD] ------ [c:] [\bin\] [showarg0] [.CMD]
[showarg0".cmd"] ----------- [C:] [\bin\] [showarg0] [.cmd]
[showarg0."cmd"] ----------- [C:] [\bin\] [showarg0] [.cmd]
[showarg0.c"md"] ----------- [C:] [\bin\] [showarg0] [.cmd]
[s"ho"warg0.cmd] ----------- [C:] [\bin\] [showarg0] [.cmd]
[s"ho"warg0] --------------- [C:] [\bin\] [showarg0] [.CMD]
["C:\bin\showarg0.cmd"] ---- [C:] [\bin\] [showarg0] [.cmd]
["c:\bin\showarg0.CMD"] ---- [c:] [\bin\] [showarg0] [.CMD]
--- Wine and Windows diverge here.
["showarg0"] --------------- [C:] [\bin\] [showarg0] [.CMD]
["SHOWARG0"] --------------- [C:] [\bin\] [SHOWARG0] [.CMD]
["showarg0.cmd"] ----------- [C:] [\bin\] [showarg0] [.cmd]
["SHOWARG0.CMD"] ----------- [C:] [\bin\] [SHOWARG0] [.CMD]
["showarg0".cmd] ----------- [C:] [\bin\] [showarg0] [.cmd]
["sho"warg0.cmd] ----------- [C:] [\bin\] [showarg0] [.cmd]
["sho"warg0] --------------- [C:] [\bin\] [showarg0] [.CMD]
["C":\bin\showarg0.cmd] ---- [C:] [\bin\] [showarg0] [.cmd]
["C:"\bin\showarg0.cmd] ---- [C:] [\bin\] [showarg0] [.cmd]
["C:\"bin\showarg0.cmd] ---- [C:] [\bin\] [showarg0] [.cmd]
["c:\"bin\showarg0.CMD] ---- [c:] [\bin\] [showarg0] [.CMD]
["C:\bin\showarg0"] -------- [C:] [\bin\] [showarg0] [.CMD]
I see two differences:
- In most cases, when a path starts with a quote, Windows somehow doesn't
parse the path correctly and/or doesn't find the batch file in the PATH.
- As long as Windows *does* find the batch file, it uses the canonical case
for the path, filename, and extension. It doesn't canonicalize the drive;
instead it uses the drive from the PATH or %0. I also tested a SMB share on XP
and Win10 (\\nAs\nAs and \\NaS\NaS), and Windows didn't canonicalize the server
name or share name. (Maybe it never does.)
--
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