https://bugs.winehq.org/show_bug.cgi?id=39932
Bug ID: 39932 Summary: bat-script with quotes cann't be called using CreateProcess Product: Wine Version: 1.9.0 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: andrej.skvortzov@gmail.com Distribution: ---
Created attachment 53340 --> https://bugs.winehq.org/attachment.cgi?id=53340 executable with source code to reproduce the problem
This problem exists in software to configure HMI panels from OWEN and Xinje.
http://www.owen.ru/catalog/graficheskaya_panel_operatora_s_sensornim_upravle... (Russian)
To reproduce this problem easily minimal test program is created. See attached archive cmd_call_batch.tar.xz.
Here are technical details of the problem. To appear following conditions need to be met: - bat-script is called using CreateProcess - name of bat-script is quoted - some parameters of bat-scrits are quoted.
For example,
"test2.bat" "param1" param2
wine runs bat-script using cmd. cmd /c "test2.bat" "param1" param2 On Windows cmd fails if name of bat-script and parameters both are quoted. To avoid this problem attached patch always removes quotes from bat-script's name before cmd is called.
https://bugs.winehq.org/show_bug.cgi?id=39932
--- Comment #1 from andrej.skvortzov@gmail.com --- Created attachment 53341 --> https://bugs.winehq.org/attachment.cgi?id=53341 patch that removes quotes from name of bat-script name
https://bugs.winehq.org/show_bug.cgi?id=39932
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW CC| |sebastian@fds-team.de Ever confirmed|0 |1
--- Comment #2 from Sebastian Lackner sebastian@fds-team.de --- Confirming. I don't think that kernel32/process is the right way to fix it though. The full commandline (including quotes) gets correctly passed to cmd.exe, which already contains code to remove quotes. In this case however, it removes a wrong pair of quotes. The whole code in cmd.exe looks unnecessarily complicated, so not 100% how to fix it.
https://bugs.winehq.org/show_bug.cgi?id=39932
--- Comment #3 from andrej.skvortzov@gmail.com --- Sebastian, I agree with you about complexity of cmd.exe code and kernel32/process is not the perfect place to fix this bug. But I decided to fix the issue in kernel32/process, because original cmd.exe (from Windows) can't run command line like this:
cmd.exe /c "test.bat" param1 "param2" "param3".
It fails with an error: "test.bat" param1 "param2" "param3" is not recognized as an internal or external command If we want to duplicate all functionality of cmd.exe, we need to repeat error cases too. Therefore I decided to remove quotes before cmd.exe is executed, i.e. in kernel32/process.
Code in cmd.exe that removes quotes is written to handle option /S:
/S Strip " quote characters from command. If command starts with a quote, the first and last quote chars in command will be removed, whether /s is specified or not.
https://bugs.winehq.org/show_bug.cgi?id=39932
--- Comment #4 from Gijs Vermeulen gijsvrm@gmail.com --- (In reply to andrej.skvortzov from comment #3) In wine-3.8 both exe's produce the same output for me. I'm not sure what is supposed to happen, so it would be a good idea to retest yourself.
https://bugs.winehq.org/show_bug.cgi?id=39932
tokktokk fdsfgs@krutt.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |fdsfgs@krutt.org
https://bugs.winehq.org/show_bug.cgi?id=39932
andrej.skvortzov@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED
--- Comment #5 from andrej.skvortzov@gmail.com --- (In reply to Gijs Vermeulen from comment #4)
(In reply to andrej.skvortzov from comment #3) In wine-3.8 both exe's produce the same output for me. I'm not sure what is supposed to happen, so it would be a good idea to retest yourself.
I've checked with wine 4.2 on Debian and it looks like the problem is fixed. And in original software problem seems to be resolved as well. Thanks!
https://bugs.winehq.org/show_bug.cgi?id=39932
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #6 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 4.3.