Bug 640379 - pipefail option causes intermittent failure of 'ls|! grep'
Summary: pipefail option causes intermittent failure of 'ls|! grep'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: ksh
Version: 5.5
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Michal Hlavinka
QA Contact: qe-baseos-tools
URL:
Whiteboard:
Depends On:
Blocks: 702016
TreeView+ depends on / blocked
 
Reported: 2010-10-05 17:11 UTC by Jeff Bastian
Modified: 2018-11-26 19:33 UTC (History)
4 users (show)

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.
Clone Of:
Environment:
Last Closed: 2012-02-21 05:50:06 UTC
Target Upstream Version:


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


Links
System 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 14:53:47 UTC

Description Jeff Bastian 2010-10-05 17:11:51 UTC
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 17:15:02 UTC
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 12:39:52 UTC
reproducible with 20100202

Comment 4 RHEL Program Management 2011-01-11 21:09:36 UTC
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 Program Management 2011-01-11 22:44:48 UTC
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 12:22:08 UTC
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 12:48:20 UTC
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 Program Management 2011-05-31 13:45:07 UTC
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 15:30:24 UTC
    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 05:50:06 UTC
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.