[issue1187] pipe fd handling issues in subprocess.py on POSIX

Andrew Nissen report at bugs.python.org
Wed May 14 01:09:14 CEST 2008

Andrew Nissen <anissen at securecomputing.com> added the comment:

In reference to Dustin's entry: That's the point; the expected behavior
is that subprocess should write data to the named files, without the
fix, it doesn't.  With the subprocess module as it stands, there are a
number of cases that will not behave as the user expects.  There were
two issues that were being addressed:

1) If a user passes in a file descriptor that is in the range 0-2, the
dup2 calls end up closing the file being passed in.

2) The other issue is the close code could end up closing file
descriptors it really shouldn't.  For example if p2cread == 1, the code
ends up closing the fd even though it really probably shouldn't.  On a
side note, I should have used a list for dup_fds instead of a dictionary.

It's been a while and I've not spent a huge amount of time getting back
up to speed; if there are any questions let me know and I'll spend some
more time on this.

Tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list