Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
DescriptionFederico Simoncelli
2011-01-05 15:33:54 UTC
Created attachment 471885[details]
test_shortprocess.py
Description of problem:
Using Popen.communicate over a short-lived process results in a broken pipe exception (errno 32) which will prevent to collect the stderr, stdout and returncode of the dead process.
Version-Release number of selected component (if applicable):
# rpm -qf /usr/lib64/python2.6/subprocess.py
python-2.6.5-3.el6.x86_64
How reproducible:
$ python test_shortprocess.py
Actual results:
None
Traceback (most recent call last):
File "test_shortprocess.py", line 7, in <module>
out, err = p.communicate(2**20 * '\0')
File "/usr/lib64/python2.7/subprocess.py", line 740, in communicate
return self._communicate(input)
File "/usr/lib64/python2.7/subprocess.py", line 1256, in _communicate
stdout, stderr = self._communicate_with_poll(input)
File "/usr/lib64/python2.7/subprocess.py", line 1319, in _communicate_with_poll
input_offset += os.write(fd, chunk)
OSError: [Errno 32] Broken pipe
Expected results:
$ python test_process-fix.py
dd: unrecognized operand `option=crash'
Try `dd --help' for more information.
1
Comment 1Federico Simoncelli
2011-01-05 15:35:17 UTC
Thanks for filing this bug.
I've filed it within the upstream python tracker as:
http://bugs.python.org/issue10963
The patch I've attached there slightly reworks the fix, and adds a unit test.
However, I'm not fully convinced that this is the correct approach, in that the change could mask stdin under-reads from poorly-written subprocesses that exit with failures but don't return with a non-zero exit code (alas, too many programs exit with 0 even when exiting with an error).
Comment 10RHEL Program Management
2011-02-22 21:35:00 UTC
Development Management has reviewed and declined this request. You may appeal
this decision by reopening this request.
Created attachment 490627[details]
Backport of the upstream patch
The attached patch is a backport of the patch applied upstream to 2.7 to the somewhat modified 2.6.6 currently in RHEL 6.1
The upstream patch contained two new test cases; I've added some additional cases over and above those ones. All of test/test_subprocess.py passes on my test build (x86_64; python-2.6.6-17 + this new patch)
I've also tested the patched version using attachment 471885[details] (from comment #0), and it fixes the reported traceback, giving the expected results.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
http://rhn.redhat.com/errata/RHBA-2011-1564.html
Created attachment 471885 [details] test_shortprocess.py Description of problem: Using Popen.communicate over a short-lived process results in a broken pipe exception (errno 32) which will prevent to collect the stderr, stdout and returncode of the dead process. Version-Release number of selected component (if applicable): # rpm -qf /usr/lib64/python2.6/subprocess.py python-2.6.5-3.el6.x86_64 How reproducible: $ python test_shortprocess.py Actual results: None Traceback (most recent call last): File "test_shortprocess.py", line 7, in <module> out, err = p.communicate(2**20 * '\0') File "/usr/lib64/python2.7/subprocess.py", line 740, in communicate return self._communicate(input) File "/usr/lib64/python2.7/subprocess.py", line 1256, in _communicate stdout, stderr = self._communicate_with_poll(input) File "/usr/lib64/python2.7/subprocess.py", line 1319, in _communicate_with_poll input_offset += os.write(fd, chunk) OSError: [Errno 32] Broken pipe Expected results: $ python test_process-fix.py dd: unrecognized operand `option=crash' Try `dd --help' for more information. 1