I'm using cygwin utilities from outside cygwin (essentially piggybacking on msysgit). I'm writing a python application that aims to target both POSIX systems and windows -- using cygwin utilities seems like a perfect fit.
I'm using subprocess in python (under the hood it is essentially CreateProcess calls). I can't seem to get the quoting to work out in a posix-compatible way: ```python >>> ret = subprocess.call(('D:/tools/cygwin64/bin/echo.exe', '"hi"')) \hi" >>> ret = subprocess.call(('D:/tools/cygwin64/bin/echo.exe', '"hi"'), >>> env={'CYGWIN': 'noglob'}) \hi\ ``` The expected behaviour (demonstrated from ubuntu): ```python >>> ret = subprocess.call(('lsb_release', '-a')) No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 15.04 Release: 15.04 Codename: vivid >>> ret = subprocess.call(('echo', '"hi"')) "hi" ``` That is, to have echo.exe not mangle my quotes Perhaps related: https://github.com/git-for-windows/git/issues/561#issuecomment-162621304 If it's helpful, here's the strace output: http://paste.pound-python.org/show/3pRuq1lAToCYKr8lKq7x/ Here's the version info, however I'm able to reproduce this in others (including msys's versions): ``` Anthony@AnthonysDesktop ~ $ /bin/echo.exe --version echo (GNU coreutils) 8.25 Packaged by Cygwin (8.25-1) Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Brian Fox and Chet Ramey. ``` I believe to have traced the problem down to this line: https://cygwin.com/git/gitweb.cgi?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/dcrt0.cc;h=cbe7f25918;hb=HEAD#l187 I'm not sure what the correct fix is here, but I'm willing to assist if possible :) The examples above are using echo but it seems to happen with any executable compiled for cygwin/msys -- the particular one I'm having issue with is actually grep. Thanks in advance! Anthony -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple