http://bugs.winehq.org/show_bug.cgi?id=33638
Bug #: 33638 Summary: wine cmd wrong extracting of command line arguments while using "%~1" Product: Wine Version: 1.5.30 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: cmd AssignedTo: wine-bugs@winehq.org ReportedBy: loentar@gmail.com Classification: Unclassified
1. wine cmd extracts "%~1" as is when no argument passed to command file, but must extract as empty string.
2. "%~1" must remove any quotation marks from arguments, but wine cmd leave it unchanged.
example: test.cmd
---- echo "%~1" ----
start under winxp:
----
test.cmd 1
"1"
test.cmd "1"
"1"
test.cmd
"" ----
start under wine cmd:
----
test.cmd 1
"1"
test.cmd "1"
""1""
test.cmd
"%~1" ----
for reference see this topic: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-...
http://bugs.winehq.org/show_bug.cgi?id=33638
Jason Edmeades us@edmeades.me.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW CC| |us@edmeades.me.uk Ever Confirmed|0 |1
--- Comment #1 from Jason Edmeades us@edmeades.me.uk 2013-06-01 18:29:41 CDT --- I do not get quite the results you do
Z:\media\sf_VMShared\bugs\33638>type echoback.cmd echo "%~1"
Z:\media\sf_VMShared\bugs\33638>echoback "1"
Z:\media\sf_VMShared\bugs\33638>echo "1" "1"
(This is with latest git)
I concur that %~1 when no arg is supplied is formatting wrong (problem (1)).
Any ideas why I am not seeing (2)?
http://bugs.winehq.org/show_bug.cgi?id=33638
--- Comment #2 from Dmitry Utkin loentar@gmail.com 2013-06-02 02:52:57 CDT --- I tried (2) on wine-1.5.30 one more time, and seems like it fixed already.
This bug was created for wine-1.5.29, and possibly I forgot to test (2) under 1.5.30, sorry for that.
Regarding (1) It is reproducible in Windows SDK v7.1 (and maybe v7.0a too).
There is many lines of code, but simplified version is something like that:
------------ @echo off :parse_args
::for debug echo conf=%conf%
if "%~1"=="/debug" ( shift & set conf=debug & goto parse_args ) if "x%~1"=="x" goto Done_Args
echo Unknown command-line switch: %~1 goto Error_Usage
:Error_Usage echo ERROR
:Done_Args
------------
I added "()" around "shift ... goto parse_args" to avoid wine bug 31057 that causes infinite loop here.
When you start that script without any args you will see:
---- test.cmd ----
--- conf= Unknown command-line switch: %~1 ERROR ---
But there must not be message about invalid command line switch, only message that is printed by Error_Usage label.
If you started with valid args, you will see the same message:
---- test.cmd /debug ----
---- conf= conf=debug Unknown command-line switch: %~1 ERROR
----
I.e. it correctly parses [if "%~1"=="/debug"] but fails to parse [if "x%~1"=="x"].
http://bugs.winehq.org/show_bug.cgi?id=33638
--- Comment #3 from Dmitry Utkin loentar@gmail.com 2013-06-02 02:54:20 CDT --- Created attachment 44620 --> http://bugs.winehq.org/attachment.cgi?id=44620 test extracting of argument "%~1"
http://bugs.winehq.org/show_bug.cgi?id=33638
--- Comment #4 from Dmitry Utkin loentar@gmail.com 2013-06-02 02:57:44 CDT --- I'm sorry, I meant "to avoid wine bug 33636".
http://bugs.winehq.org/show_bug.cgi?id=33638
Jason Edmeades us@edmeades.me.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|wine-bugs@winehq.org |us@edmeades.me.uk
--- Comment #5 from Jason Edmeades us@edmeades.me.uk 2013-06-02 15:34:31 CDT --- Attaching patch, goes with patch on 33636
http://bugs.winehq.org/show_bug.cgi?id=33638
--- Comment #6 from Jason Edmeades us@edmeades.me.uk 2013-06-02 15:34:52 CDT --- Created attachment 44633 --> http://bugs.winehq.org/attachment.cgi?id=44633 Expand args better
http://bugs.winehq.org/show_bug.cgi?id=33638
--- Comment #7 from Jason Edmeades us@edmeades.me.uk 2013-06-02 17:06:07 CDT --- Patch submitted http://www.winehq.org/pipermail/wine-patches/2013-June/124543.html
http://bugs.winehq.org/show_bug.cgi?id=33638
Jason Edmeades us@edmeades.me.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |2b9649d9db1f4b769f6a80407ae | |2ea6dc364aaeb Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #8 from Jason Edmeades us@edmeades.me.uk 2013-06-04 16:01:04 CDT --- Committed
http://bugs.winehq.org/show_bug.cgi?id=33638
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #9 from Alexandre Julliard julliard@winehq.org 2013-06-07 15:01:13 CDT --- Closing bugs fixed in 1.6-rc1.