Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 4 product line. The current stable release is 4.9. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 429153

Summary: scripts failing under ksh
Product: Red Hat Enterprise Linux 4 Reporter: Chuck Mead <csm>
Component: kshAssignee: Tomas Smetana <tsmetana>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.5CC: esammons, i.mortimer, mef
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2008-0704 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-07-24 19:52:49 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: 435159    

Description Chuck Mead 2008-01-17 16:41:19 UTC
Description of problem: custom scripting written by users is failing under ksh
but runs perfectly under bash.


Version-Release number of selected component (if applicable):
ksh-20050202-0.4E.4.x86_64


How reproducible: here are the scripts in question

#!/bin/ksh
typeset -i j=1
while [ $j -le 1000 ]; do
./test_ret.sh
j=j+1
done

echo

The above script runs fine with /bin/bash as the shell. With /bin/ksh it fails
quite often. Here is the script it is calling:

#!/bin/ksh
TEMP=/bb/data/oracle/logs/test_return.tmp
TEMPLOG=/bb/data/oracle/logs/cmdout.tmp
LOG=/bb/data/oracle/logs/test_return.log

cat /dev/null > $LOG
touch $TEMP
#rm -f $TEMP > $TEMPLOG 2>&1
rm -f $TEMP > $TEMPLOG 2>&1
if [ ${?} -ne 0 ]; then
  echo
  echo "`date` - Command return non successful for rm -f $TEMP" | tee -a $LOG
  ls -l $TEMP | tee -a $LOG
  cat $TEMPLOG | tee -a $LOG
else
  echo -n "."
fi

The user running these scripts is oracle:dba and this user has all the rights
necessary to run this code. The same exact scripts with the bang path changed to
/bin/bash runs perfectly.



Steps to Reproduce:
1. see above
2.
3.
  
Actual results: Script fails like this:

Thu Jan 17 10:44:03 EST 2008 - Command return non successful for rm -f
/bb/data/oracle/logs/test_return.tmp
ls: /bb/data/oracle/logs/test_return.tmp: No such file or directory
.........................................................................
......................................



Expected results:

The scripts should provide only periods as output.

Additional info:

Obviously these are test scripts written expressly to test a recurring issue
with production script failures.

Comment 1 Tomas Smetana 2008-01-18 11:35:41 UTC
This has the same cause as in the bug #232640 and bug #426132.  I have already a
patch for them.

Comment 2 Chuck Mead 2008-01-18 16:11:20 UTC
so does this mean that a working patch is forthcoming?

Comment 3 Tomas Smetana 2008-01-21 10:32:03 UTC
You may wish to test the packages from here:
http://tsmetana.fedorapeople.org/ksh/el4-test/

Comment 4 RHEL Program Management 2008-02-01 18:58:27 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".

Comment 7 Chuck Mead 2008-02-04 15:41:02 UTC
The test scripts run fine with the new shell... prior to installing the rpm we
renamed the old ksh to ksh.old. When we change the bang path to the old ksh the
scripts fail immediately. So on the surface this looks good. There are some
other scripts (production) which need to run... we will wait a while and let
them run and see what it looks like... but for now things look pretty good.

Comment 19 Ian Mortimer 2008-05-06 00:55:27 UTC
The updated package also seems to have fixed (*) some random stack faults I was
getting on x86_64 el4.  (src rpm rebuilt on x86_64 since there's only i386 at
http://tsmetana.fedorapeople.org/ksh/el4-test/).

(*) with ksh-20050202-0.4E.2, 5 consecutive runs on the same data resulted in 1
successful completion and 4 stack faults all at different places.  With
ksh-20050202-0.5E.4, 5 consecutive runs results in 5 successful completions.

Comment 22 Tomas Smetana 2008-05-29 05:55:11 UTC
*** Bug 444374 has been marked as a duplicate of this bug. ***

Comment 23 errata-xmlrpc 2008-07-24 19:52:49 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2008-0704.html