Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 640379 - pipefail option causes intermittent failure of 'ls|! grep'
pipefail option causes intermittent failure of 'ls|! grep'
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: ksh (Show other bugs)
5.5
All Linux
medium Severity medium
: rc
: ---
Assigned To: Michal Hlavinka
qe-baseos-tools
: Patch
Depends On:
Blocks: 702016
  Show dependency treegraph
 
Reported: 2010-10-05 13:11 EDT by Jeff Bastian
Modified: 2018-06-20 03:20 EDT (History)
4 users (show)

See Also:
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 00:50:06 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
reproducer program (376 bytes, text/plain)
2010-10-05 13:11 EDT, Jeff Bastian
no flags Details
backported ksh patch (388 bytes, patch)
2010-10-05 13:15 EDT, Jeff Bastian
no flags Details | Diff
patch to fix this (1.50 KB, patch)
2011-03-14 08:48 EDT, Michal Hlavinka
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0159 normal SHIPPED_LIVE ksh bug fix and enhancement update 2012-02-20 09:53:47 EST

  None (edit)
Description Jeff Bastian 2010-10-05 13:11:51 EDT
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:
Comment 1 Jeff Bastian 2010-10-05 13:15:02 EDT
Created attachment 451732 [details]
backported ksh patch

Siddhesh Poyarekar narrowed down the upstream changes between 20100811 and 20100924 found this patch solves the problem.
Comment 3 Michal Hlavinka 2010-10-06 08:39:52 EDT
reproducible with 20100202
Comment 4 RHEL Product and Program Management 2011-01-11 16:09:36 EST
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.
Comment 5 RHEL Product and Program Management 2011-01-11 17:44:48 EST
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 8 Michal Hlavinka 2011-03-14 08:22:08 EDT
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 ]
Comment 10 Michal Hlavinka 2011-03-14 08:48:20 EDT
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.
Comment 12 RHEL Product and Program Management 2011-05-31 09:45:07 EDT
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.
Comment 15 Michal Hlavinka 2012-01-18 10:30:24 EST
    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.
Comment 16 errata-xmlrpc 2012-02-21 00:50:06 EST
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

Note You need to log in before you can comment on or make changes to this bug.