This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Strange quoting behaviour using cygwin utilities outside shell

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:

>>> ret ='D:/tools/cygwin64/bin/echo.exe', '"hi"'))
>>> ret ='D:/tools/cygwin64/bin/echo.exe', '"hi"'), env={'CYGWIN': 'noglob'})

The expected behaviour (demonstrated from ubuntu):

>>> ret ='lsb_release', '-a'))
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 15.04
Release:    15.04
Codename:    vivid
>>> ret ='echo', '"hi"'))

That is, to have echo.exe not mangle my quotes

Perhaps related:

If it's helpful, here's the strace output:

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 <>.
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:;a=blob;f=winsup/cygwin/;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!


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]