Mailing List Archive

[issue1187] pipe fd handling issues in subprocess.py on POSIX
Dustin J. Mitchell <dustin@v.igoro.us> added the comment:

I see that, on running your fix_fileno.py, nothing is output to
/tmp/stdout.test. I don't necessarily see the link to your fix. Could
you describe the problem and/or add comments to your patch to explain why
these checks are made?

----------
nosy: +djmitche

__________________________________
Tracker <report@bugs.python.org>
<http://bugs.python.org/issue1187>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue1187] pipe fd handling issues in subprocess.py on POSIX [ In reply to ]
Andrew Nissen <anissen@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@bugs.python.org>
<http://bugs.python.org/issue1187>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue1187] pipe fd handling issues in subprocess.py on POSIX [ In reply to ]
Dustin J. Mitchell <dustin@v.igoro.us> added the comment:

Hmm.. I see why you didn't write a unit test for this!

Attached is a patch with a unit test that tickles this behavior, along
with Andrew's fix.

Added file: http://bugs.python.org/file10338/1187-dustin.patch

__________________________________
Tracker <report@bugs.python.org>
<http://bugs.python.org/issue1187>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com