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