[issue8972] subprocess.list2cmdline doesn't quote the & character

Jean-Paul Calderone report at bugs.python.org
Sat Jun 12 20:15:39 CEST 2010


Jean-Paul Calderone <exarkun at twistedmatrix.com> added the comment:

Thanks.

I'm not sure this is a correct change.  And in fact, I would say that the current quoting of | is also incorrect.

& and | (and ^ and perhaps several others) have special meaning to cmd.exe.  list2cmdline is documented as applying the quoting rules which the "MS C runtime" uses: cmd.exe and the C runtime are different and have different rules.

It seems to me that whoever added the | handling to list2cmdline was confused about the purpose of this function, or failed to properly document the function.

It would make more sense to document list2cmdline as applying cmd.exe-style quoting rules, if those are the rules it is actually going to implement.

A better option, though, would probably be to implement the cmd.exe quoting rules in a different function from the MS C runtime rules.

This all might benefit from a sanity check from someone who's actually worked with the subprocess module before, though (ie, not me).

----------

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


More information about the Python-bugs-list mailing list