Bug 522002 - ksh is showing an incorrect exit status ($?) in some cases
Summary: ksh is showing an incorrect exit status ($?) in some cases
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: ksh
Version: 5.2
Hardware: x86_64
OS: Linux
low
high
Target Milestone: ---
: ---
Assignee: Michal Hlavinka
QA Contact: BaseOS QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-09-09 03:21 UTC by Ryan Leslie
Modified: 2009-09-15 10:30 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-15 10:30:33 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Ryan Leslie 2009-09-09 03:21:40 UTC
$ uname -a
Linux <edited> 2.6.18-92.1.10.el5 #1 SMP Wed Jul 23 03:56:11 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux

$ /bin/ksh --version
  version         sh (AT&T Research) 93t+ 2009-01-20

$ cat works
#!/bin/ksh

echo hi | while read f
do
    cat notarealfile || echo fails
done

$ ./works  # The result is expected.
cat: notarealfile: No such file or directory
fails

$ cat broken
#!/bin/ksh

echo hi | while read f
do
    cat notarealfile || echo fails
done
exit 0

$ ./broken  # The exit status of 'cat notarealfile' will incorrectly be 0, so 'fails' will not be printed.
cat: notarealfile: No such file or directory

$ diff works broken  # All we did was add 'exit 0'
6a7
> exit 0

$

Comment 1 Michal Hlavinka 2009-09-15 10:02:43 UTC
this bug was introduced in upstream ksh 2009-01-20 and fixed in upstream ksh 2009-02-02

Comment 2 Michal Hlavinka 2009-09-15 10:30:33 UTC
this bug exists only in ksh 2009-01-20, but RHEL 5 contains ksh 2008-02-02


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