https://bugs.winehq.org/show_bug.cgi?id=44132
Bug ID: 44132 Summary: Luajit’s os.execute() does not work well with quoted arguments Product: Wine Version: 2.19 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: cmd Assignee: wine-bugs@winehq.org Reporter: kp-pav@yandex.ru Distribution: ---
Created attachment 59873 --> https://bugs.winehq.org/attachment.cgi?id=59873 Compiled luajit. That was unpacked to C:\luajit.
With luajit installed to C:\luajit (cross-compiled with mingw as they do not provide downloadable binaries)
luajit -e "print(os.execute("\"C:\luajit\luajit\" -e \"print(1)\""))"
yields
Can't recognize 'C:\luajit\luajit" -e "print(1)' as an internal or external command, or batch script. 9009
. This is bad because this is actually how luarocks is creating directories: it runs `C: & cd … & "path\to\mkdir" -p "path\to\dir\to\create"` (note the spaces around `&` which do not work, but this is a separate issue).
Note that problem is additional pair of quotes:
luajit -e "print(os.execute("\"C:\luajit\luajit\" -e print(1)"))"
works just fine.
Wine version used is 32-bit wine-any-2.19 from Gentoo portage on a 64-bit multilib system, USE="X alsa cups fontconfig gecko gstreamer jpeg lcms mono ncurses nls opengl perl png realtime run-exes scanner ssl threads truetype udisks xml".
https://bugs.winehq.org/show_bug.cgi?id=44132
Ken Sharp imwellcushtymelike@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|major |normal
https://bugs.winehq.org/show_bug.cgi?id=44132
tokktokk fdsfgs@krutt.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |fdsfgs@krutt.org
https://bugs.winehq.org/show_bug.cgi?id=44132
Jason Edmeades us@edmeades.me.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |us@edmeades.me.uk
--- Comment #1 from Jason Edmeades us@edmeades.me.uk --- This doesnt work on windows either, and I believe needs to be resolved invalid.
(The root cause of your problem based on the description of the mkdir issue is probably bug#40694 (just attached a patch) in that the "C:<space>&" fails)
(Windows 10:)
C:\luajit>luajit -e "print(os.execute("\"C:\luajit\luajit\" -e \"print(1)\""))" 'C:\luajit\luajit" -e "print' is not recognized as an internal or external command, operable program or batch file. nil exit 1
In effect this launches: cmd /c "C:\luajit\luajit.exe" -e "print(1)"
Windows states (see cmd.exe /?):
If /C or /K is specified, then the remainder of the command line after the switch is processed as a command line, where the following logic is used to process quote (") characters:
1. If all of the following conditions are met, then quote characters on the command line are preserved:
- no /S switch - exactly two quote characters - no special characters between the two quote characters, where special is one of: &<>()@^| - there are one or more whitespace characters between the two quote characters - the string between the two quote characters is the name of an executable file.
2. Otherwise, old behavior is to see if the first character is a quote character and if so, strip the leading character and remove the last quote character on the command line, preserving any text after the last quote character.
You hit condition 2, so the first and last quote are removed, and it tries to run the rest as a single command, which obviously fails.
https://bugs.winehq.org/show_bug.cgi?id=44132
Jason Edmeades us@edmeades.me.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID
--- Comment #2 from Jason Edmeades us@edmeades.me.uk --- Resolving invalid as the same testcase fails to work on windows as well. Please reopen if you can replicate a problem in wine.
https://bugs.winehq.org/show_bug.cgi?id=44132
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED CC| |nerv@dawncrow.de
--- Comment #3 from André H. nerv@dawncrow.de --- closing invalid