This is an archive of the discontinued LLVM Phabricator instance.

Add a space to work around a Windows CPython / MSys quoting bug
ClosedPublic

Authored by rnk on Oct 20 2016, 1:09 PM.

Details

Summary

The rules for quoting the command line that a subprocess receives are
user space conventions implemented by the C runtime. Python's quoting
rules are implemented here:
https://github.com/python/cpython/blob/c30098c8c6014f3340a369a31df9c74bdbacc269/Lib/subprocess.py#L725

The result is that the final command line C string computed by Python is
'echo \"'. Mingw doesn't appear to interpret that backslash as escaping
the quote because it is not already inside a quoted region. As a result,
our echo command prints a single backslash instead of a quote.

The whole issue can be sidestepped by adding a space a forcing Python to
put the argument to echo in double quotes.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk updated this revision to Diff 75341.Oct 20 2016, 1:09 PM
rnk retitled this revision from to Add a space to work around a Windows CPython / MSys quoting bug.
rnk updated this object.
rnk added reviewers: inglorion, ruiu.
rnk added a subscriber: llvm-commits.
inglorion accepted this revision.Oct 20 2016, 1:11 PM
inglorion edited edge metadata.

lgtm, thanks!

This revision is now accepted and ready to land.Oct 20 2016, 1:11 PM
ruiu accepted this revision.Oct 20 2016, 1:11 PM
ruiu edited edge metadata.

LGTM

This revision was automatically updated to reflect the committed changes.