Bug 640379
Summary: | pipefail option causes intermittent failure of 'ls|! grep' | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 5 | Reporter: | Jeff Bastian <jbastian> | ||||||||
Component: | ksh | Assignee: | Michal Hlavinka <mhlavink> | ||||||||
Status: | CLOSED ERRATA | QA Contact: | qe-baseos-tools-bugs | ||||||||
Severity: | medium | Docs Contact: | |||||||||
Priority: | medium | ||||||||||
Version: | 5.5 | CC: | kvolny, mfranc, ovasik, spoyarek | ||||||||
Target Milestone: | rc | Keywords: | Patch | ||||||||
Target Release: | --- | ||||||||||
Hardware: | All | ||||||||||
OS: | Linux | ||||||||||
Whiteboard: | |||||||||||
Fixed In Version: | ksh-20100621-1.el5 | Doc Type: | Bug Fix | ||||||||
Doc Text: |
Previously, ksh did not always wait for a pipeline to complete when the pipefail option was used. Consequently, a failed exit status was erroneously reported even when the pipeline had not failed. With this update, the code has been improved and the pipefail option now functions as expected.
|
Story Points: | --- | ||||||||
Clone Of: | Environment: | ||||||||||
Last Closed: | 2012-02-21 05:50:06 UTC | Type: | --- | ||||||||
Regression: | --- | Mount Type: | --- | ||||||||
Documentation: | --- | CRM: | |||||||||
Verified Versions: | Category: | --- | |||||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||||
Embargoed: | |||||||||||
Bug Depends On: | |||||||||||
Bug Blocks: | 702016 | ||||||||||
Attachments: |
|
Created attachment 451732 [details]
backported ksh patch
Siddhesh Poyarekar narrowed down the upstream changes between 20100811 and 20100924 found this patch solves the problem.
reproducible with 20100202 This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux. This request was erroneously denied for the current release of Red Hat Enterprise Linux. The error has been fixed and this request has been re-proposed for the current release. Comment on attachment 451732 [details]
backported ksh patch
this patch does not work, it's causing regressions:
test basic.sh begins at 2011-03-14+13:20:37
basic.sh[477]: pipefail causing /bin/true to wait for other end of pipe
test basic.sh failed at 2011-03-14+13:21:02 with exit code 1 [ 95 tests 1 error ]
Created attachment 484163 [details]
patch to fix this
not that different, I know, just one section missing. Despite we did not used it in version for which last patch was prepared, we need it now.
This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux. Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Previously, ksh did not always wait for a pipeline to complete when the pipefail option was used. Consequently, a failed exit status was erroneously reported even when the pipeline had not failed. With this update, the code has been improved and the pipefail option now functions as expected. 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-2012-0159.html |
Created attachment 451728 [details] reproducer program Description of problem: The ksh pipefail option does not wait for the pipeline to complete and can incorrectly report a failed exit status for a command like ls -l /bin/ksh | ! grep -e junk Version-Release number of selected component (if applicable): ksh-20100202-1.el5_5.1 How reproducible: every time Steps to Reproduce: 1. download and run the attached pipefail.ksh script Actual results: within approximately 1000 iterations of the loop, it will fail: ... running 367 running 368 running 369 The script executed for 2.926 seconds while looping 370 times before failing. Expected results: never fail Additional info: