[issue27457] shlex.quote incorrectly quotes ampersants, pipes

2016-07-05 Thread R. David Murray
R. David Murray added the comment: If you use shell=True you can do almost anything you can do in the shell, but making it safe is up to you. We provide shlex.quote to help you with that, but only you can know what parts of the expression need quoting and what don't. It sounds like you might

[issue27457] shlex.quote incorrectly quotes ampersants, pipes

2016-07-05 Thread klo uo
klo uo added the comment: So there is no reliable way for converting chained command line sequence to string on *nix, when I have to to use string as shell=True? -- ___ Python tracker _

[issue27457] shlex.quote incorrectly quotes ampersants, pipes

2016-07-05 Thread R. David Murray
R. David Murray added the comment: Yes, the point of shlex.quote is to get something that is *not* special to the shell, and therefore safe to pass to the shell. If you *want* an & in your command, just pass it, don't quote it. quote is for *untrusted* data, like filenames received from a us

[issue27457] shlex.quote incorrectly quotes ampersants, pipes

2016-07-05 Thread Xiang Zhang
Xiang Zhang added the comment: Doesn't this the expected behaviour of shlex.quote, return a shell-escaped version of the string s? If && is not quoted, how about "pwd && rm -rf ~"? I think in your case there is no need to use shlex.quote. -- nosy: +xiang.zhang

[issue27457] shlex.quote incorrectly quotes ampersants, pipes

2016-07-05 Thread klo uo
New submission from klo uo: Example code: Python 3.4.3 (default, Oct 14 2015, 20:28:29) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import shlex >>> cmd = ["pwd", "&&", "ls"] >>> ' '.join(shlex.quote(arg