shypike <shyp...@sabnzbd.org> added the comment:

A work-around could be that the caller puts double quotes around the individual 
elements of the sequence that need it.
However, this won't work because list2cmdline doesn't handle backslash quoting 
properly. An element like r'"foo"' is translated to r'\"foo\"'. This is 
incorrect because cmd.exe cannot handle this. The backslash may be appropriate 
for embedded quotes (like in r'foo"bar'), but not for outer quotes (like in 
r'"foobar"').

The user shouldn't have to worry with adding quotes anyway, so it would be 
better to demand that '|' and '&' are passed as separate elements in the 
sequence. Example ['echo', 'foo', '&', 'bar'].
When someone passes ['echo', 'foo&bar'], it is very obvious that r'echo 
"foo&bar"' is expected and not r'echo foo & bar'.

I have added a patch for this way of working of list2cmdline.

----------
Added file: http://bugs.python.org/file17650/list2cmdline_proper_fix.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8972>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to