https://bugs.winehq.org/show_bug.cgi?id=44369
Bug ID: 44369 Summary: cmd's %0 path variables (e.g. %~dp0) wrong inside subroutine call Product: Wine Version: 3.0-rc6 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: cmd Assignee: wine-bugs@winehq.org Reporter: ryan.prichard@gmail.com Distribution: ---
Test program (C:\bin\workaround.cmd):
@echo off call :fix exit /b :fix echo [%0] [%~d0] [%~p0] [%~n0] [%~x0] exit /b
Expected behavior (tested on XP):
C:>set PATH=C:\bin;%PATH%
C:>workaround.cmd [:fix] [C:] [\bin] [workaround] [.cmd]
C:>"workaround.cmd" [:fix] [C:] [\bin] [workaround] [.cmd]
C:>"w"or"k"aroun"d.c"md [:fix] [C:] [\bin] [workaround] [.cmd]
Behavior on wine-3.0-rc6:
c:>set PATH=C:\bin;%PATH%
c:>workaround.cmd [:fix] [c:] [] [:fix] []
c:>"workaround.cmd" [:fix] [c:] [] [:fix] []
c:>"w"or"k"aroun"d.c"md [:fix] [c:] [] [:fix] []
Background:
The Android NDK generates wrapper batch files that invoke clang.exe. If the wrapper is invoked from the PATH using double-quotes, then %~dp0 is wrong (when using Windows CMD). A workaround I've found is to evaluate %~dp0 in a subroutine in the batch file. This workaround works with Windows CMD, but breaks with Wine CMD. (It expands to the working directory instead.)
See https://github.com/android-ndk/ndk/issues/616#issuecomment-358117090.
FWIW: Wine CMD doesn't have the same %~dp0 bugginess as Windows CMD that motivated the GitHub issue I linked to. Wine handles all of the example command lines on that GitHub comment consistently (aside from case differences in the drive letter or the filename extension). If Wine tries to match Windows bug-for-bug, then maybe this too should change.
https://bugs.winehq.org/show_bug.cgi?id=44369
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |testcase Ever confirmed|0 |1 Status|UNCONFIRMED |NEW CC| |dark.shadow4@web.de
--- Comment #1 from Fabian Maurer dark.shadow4@web.de --- Confirming issue.
FWIW: Wine CMD doesn't have the same %~dp0 bugginess as Windows CMD that motivated the GitHub issue I linked to. Wine handles all of the example command lines on that GitHub comment consistently (aside from case differences in the drive letter or the filename extension). If Wine tries to match Windows bug-for-bug, then maybe this too should change.
Yeah, I guess that should change, too. Mind creating a bug report for that one, too? Including a small sample would be awesome.
https://bugs.winehq.org/show_bug.cgi?id=44369
--- Comment #2 from Ryan Prichard ryan.prichard@gmail.com --- Ok, I filed https://bugs.winehq.org/show_bug.cgi?id=44373 for the Wine-vs-Windows differences in %0 path variables w.r.t. quoting and case-canonicalization.
https://bugs.winehq.org/show_bug.cgi?id=44369
Jason Edmeades us@edmeades.me.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- Assignee|wine-bugs@winehq.org |us@edmeades.me.uk CC| |us@edmeades.me.uk
https://bugs.winehq.org/show_bug.cgi?id=44369
--- Comment #3 from Jason Edmeades us@edmeades.me.uk --- https://www.winehq.org/pipermail/wine-devel/2018-August/130220.html
https://bugs.winehq.org/show_bug.cgi?id=44369
Jason Edmeades us@edmeades.me.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Fixed by SHA1| |987fee3791d24a63aacc0b49f59 | |275b62c943815 Resolution|--- |FIXED
--- Comment #4 from Jason Edmeades us@edmeades.me.uk --- Committed
https://bugs.winehq.org/show_bug.cgi?id=44369
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 3.15.
https://bugs.winehq.org/show_bug.cgi?id=44369
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |3.0.x
https://bugs.winehq.org/show_bug.cgi?id=44369
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|3.0.x |---
--- Comment #6 from Michael Stefaniuc mstefani@winehq.org --- Removing the 3.0.x milestone from bug fixes included in 3.0.4.