[Bug 33638] wine cmd wrong extracting of command line arguments while using "%~1"

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Jun 2 02:52:57 CDT 2013


http://bugs.winehq.org/show_bug.cgi?id=33638

--- Comment #2 from Dmitry Utkin <loentar at 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"].

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
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