[msys2-runtime] arguments mangled when passed to cygwin executables #3548
Comments
gnomesysadmins
pushed a commit
to GNOME/pango
that referenced
this issue
Apr 5, 2018
…thon bug For some reason MinGW Python (the one running meson) mangles arguments for this case (even adding a space makes it work). Since quotes are not needed here just drop them. Python issue filed upstream: msys2/MINGW-packages#3548 https://bugzilla.gnome.org/show_bug.cgi?id=795012
|
Same problem with the official Python when calling the msys2 echo exe. |
|
Some more. Python uses list2cmdline() to convert the list of arguments to a single argument string. CommandLineToArgvW() gets the original list back, so this looks to me as if Python is doing the right thing here and the error is on the msys/cygwin side of things. import ctypes
from ctypes import wintypes
from subprocess import list2cmdline
CommandLineToArgvW = ctypes.windll.shell32.CommandLineToArgvW
CommandLineToArgvW.restype = ctypes.POINTER(wintypes.LPWSTR)
CommandLineToArgvW.argtypes = [
wintypes.LPCWSTR,
ctypes.POINTER(ctypes.c_int),
]
lpCommandLine = list2cmdline(['echo', '--foo="bar"', '--quux="baz"'])
argc = ctypes.c_int()
argv = CommandLineToArgvW(lpCommandLine, ctypes.byref(argc))
argv = argv[:argc.value]
print(argv) |
|
ok, cygwin bug I guess: C:\msys64\usr\bin>echo.exe -DFOO=\"BAR\"
-DFOO=\BAR"Reproduced with upstream cygwin. |
|
I've "filed" a bug: http://cygwin.org/ml/cygwin/2019-06/msg00189.html |
|
Here is a reproducer written in C: https://gist.github.com/lazka/3d828f9ed3bdf6b981eeb5edca65c657 |
|
No response on the "bugtracker" :/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Same problem with Python2 and Python3
Prints
--foo=\bar" --quux="baz"instead of--foo="bar" --quux="baz"edit: minimal example
['echo', '"']This breaks some meson builds when perl scripts are called. For example pango with help2man.
The text was updated successfully, but these errors were encountered: