-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[msys2-runtime] arguments mangled when passed to cygwin executables #3548
Comments
…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: https://github.com/Alexpux/MINGW-packages/issues/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" :/ |
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: