[docs] python2.7/subprocess.py Popen on Ubuntu 10.04 Bug

Eyal Moscovici EYALMO at il.ibm.com
Wed Oct 30 14:59:10 CET 2013


I found that using Popen with both executable and shell parameters set 
creates a bug:

For example:


Popen(["-a"], exacutable="/bin/ls", shell=True)

Exacutes: /bin/ls -c -a instead of: /bin/sh -c "/bin/ls -a" 

The bug in the function: 
def _execute_child(self, args, executable, preexec_fn, close_fds,
                           cwd, env, universal_newlines,
                           startupinfo, creationflags, shell,
                           p2cread, p2cwrite,
                           c2pread, c2pwrite,
                           errread, errwrite):
            """Execute program (POSIX version)"""

Lines: 1124-1127:

if shell:
                args = ["/bin/sh", "-c"] + args
                if executable:
                    args[0] = executable

Eyal Moscovici
Networking and Virtualization Technologies
IBM Haifa Research Lab
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20131030/3d2260c1/attachment.html>

More information about the docs mailing list