[issue15918] subprocess.Popen reads errpipe_read incorrectly, can result in short read
Vitaly
report at bugs.python.org
Tue Sep 11 19:52:48 CEST 2012
Vitaly added the comment:
My bug report refers to the following code block in subprocess.py. The problem is the same in 2.6.7 and 2.7.3:
=== From subprocess.py in Python 2.7.3 Source Distribution:
# Wait for exec to fail or succeed; possibly raising exception
# Exception limited to 1M
data = _eintr_retry_call(os.read, errpipe_read, 1048576)
finally:
# be sure the FD is closed no matter what
os.close(errpipe_read)
===
However, Python 3.2.3 appears to be doing this correctly; it loops, gathers the data from multiple os.read calls, and doesn't make huge (1048576) os.read requests:
=== from subprocess.py in 3.2.3 source distribution
# Wait for exec to fail or succeed; possibly raising an
# exception (limited in size)
data = bytearray()
while True:
part = _eintr_retry_call(os.read, errpipe_read, 50000)
data += part
if not part or len(data) > 50000:
break
===
----------
versions: +Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15918>
_______________________________________
More information about the Python-bugs-list
mailing list