https://bugs.winehq.org/show_bug.cgi?id=37245
Bug ID: 37245 Summary: Can't execute cmd /c "script.bat" "argument" Product: Wine Version: 1.7.26 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: cmd Assignee: wine-bugs@winehq.org Reporter: mhlavink@redhat.com
Created attachment 49533 --> https://bugs.winehq.org/attachment.cgi?id=49533 trace
I'm trying to make Profili 2 Pro work in wine. So far I reached the point where it works, but there is an issue when application tries to execute is *.bat wrapper.
I get this error (more complete trace is attached): Can't recognize 'C:\ProfiliProV2\xf.bat" "C:\ProfiliProV2\XFoil.exe' as an internal or external command, or batch script.
With trace enabled, I get: wmain Full commandline 'L"C:\windows\system32\cmd.exe /c "C:\ProfiliProV2\xf.bat" "C:\ProfiliProV2\XFoil.exe""'
WCMD_DumpCommands Parsed line: WCMD_DumpCommands 0x121c18 0 00 (nil) L"C:\ProfiliProV2\xf.bat" "C:\ProfiliProV2\XFoil.exe" Redir:L""
command has stripped first and last " but the quotes in the middle remained
WCMD_process_commands Executing command: 'L"C:\ProfiliProV2\xf.bat" "C:\ProfiliProV2\XFoil.exe"'
WCMD_execute param1: L":\ProfiliProV2\xf.bat"", param2: L"C:\ProfiliProV2\XFoil.exe"
param1 is missing 'C' as first character and has surplus " at the end
WCMD_run_program first param='L"C:\ProfiliProV2\xf.bat C:\ProfiliProV2\XFoil.exe"'
and looking for the command in that composed path fails (as expected):
Searching in 'L"C:\ProfiliProV2\xf.bat C:\ProfiliProV2\"' for 'L"XFoil.exe"'
The problem related to wcmdmain.c:wmain(...) around line 2590:
/* strip first and last quote characters if opt_s; check for invalid * executable is done later */ if (opt_s && *cmd=='"') WCMD_strip_quotes(cmd);
before this, cmd is: "C:\ProfiliProV2\xf.bat" "C:\ProfiliProV2\XFoil.exe" after this, cmd is C:\ProfiliProV2\xf.bat" "C:\ProfiliProV2\XFoil.exe the quotes in the middle remains.
opt_s was not specified, but was triggered on by checks around 2450: there is at least one quote (pass), there is a second quote(pass) and there is no more quotes(fail) - the last one fails and sets opt_s. My guess would be that those checks should be done on first argument, not all of them together.
The xf.bat is very simple wrapper: %1 <XFoil.cmd >XFoil.out exit
https://bugs.winehq.org/show_bug.cgi?id=37245
Jason Edmeades us@edmeades.me.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |us@edmeades.me.uk
--- Comment #1 from Jason Edmeades us@edmeades.me.uk --- Michal, I appreciate this is old, but do you recall who is calling xf.bat in this scenario and can you confirm it actually works on windows?
What you describe is what I would expect to happen on normal windows (yes, it feels counter intuitive but it really does) and yet I also feel there's a bug here somewhere as there's about 3 similar bugs.
If you look at the cmd /? help, it describes what happens when you run cmd /c <string> and this looks like its triggered condition (2) under wine due to the multiple quotes, and this is also the behaviour I see when experimenting on windows.
https://bugs.winehq.org/show_bug.cgi?id=37245
Jason Edmeades us@edmeades.me.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEEDINFO Ever confirmed|0 |1
--- Comment #2 from Jason Edmeades us@edmeades.me.uk --- This needs more info to progress:
C:\profiliProV2>dir Volume in drive C has no label. Volume Serial Number is 4422-4C03
Directory of C:\profiliProV2
29/06/2018 19:52 <DIR> . 29/06/2018 19:52 <DIR> .. 29/06/2018 19:53 7 xf.bat 1 File(s) 7 bytes 2 Dir(s) 174,277,668,864 bytes free
C:\profiliProV2>C:\windows\system32\cmd.exe /c "C:\ProfiliProV2\xf.bat" "C:\ProfiliProV2\XFoil.exe" The filename, directory name, or volume label syntax is incorrect.
C:\profiliProV2>C:\windows\system32\cmd.exe /c ""C:\ProfiliProV2\xf.bat" "C:\ProfiliProV2\XFoil.exe""
<starts batch with parameter of> "C:\ProfiliProV2\XFoil.exe"
This was all on windows 10
https://bugs.winehq.org/show_bug.cgi?id=37245
--- Comment #3 from Jason Edmeades us@edmeades.me.uk --- As an aside, I tried the trial edition of this, and played with menus under windows but couldnt get it to visibly drive the batch program, unfortunately