[issue8987] Distutils doesn't quote Windows command lines properly

Steve Dower report at bugs.python.org
Sat Aug 22 00:30:53 CEST 2015


Steve Dower added the comment:

That would break paths like "\" or "D:\" ("D:" != "D:\" - the backslash is meaningful here), but I'm fairly sure _nt_quote_args could add '\\"' to the end if it ends in a backslash already (to escape the trailing slash):

     for i, arg in enumerate(args):
         if ' ' in arg:
-            args[i] = '"%s"' % arg
+            args[i] = '"%s%s"' % (arg, '\\' if arg.endswith('\\') else '')
     return args

For distutils, that's probably an okay fix since we're already quoting everything, and it doesn't try to make things too smart. But it would break people who are already escaping their own trailing backslash, and doesn't provide a workaround that will work both before and after this change. Especially for something like distutils, where people often have one setup.py for all Python versions, this is pretty important.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8987>
_______________________________________


More information about the Python-bugs-list mailing list