Red Hat Bugzilla – Bug 865121
eval not return the RC of the evaluated command
Last modified: 2016-08-22 07:05:52 EDT
Description of problem:
when eval a string which include "$?" shell variable , result is not right.
Version-Release number of selected component (if applicable):
# uname -r
# rpm -q mksh
# rpm -q ksh
# rpm -q bash
Steps to Reproduce:
1. In mksh :
# /bin/mksh -c 'echo $KSH_VERSION;STRING="[ \$? -eq 0 ] && echo EXEC OK || echo EXEC ERR";./bad_cmd;eval $STRING'
@(#)MIRBSD KSH R39 2009/08/01
/bin/mksh: ./bad_cmd: not found
2. In ksh :
# /bin/ksh -c 'echo $KSH_VERSION;STRING="[ \$? -eq 0 ] && echo EXEC OK || echo EXEC ERR";./bad_cmd;eval $STRING'
Version JM 93t+ 2010-06-21
/bin/ksh: ./bad_cmd: not found [No such file or directory]
3. In bash :
# /bin/bash -c 'echo $BASH_VERSION;STRING="[ \$? -eq 0 ] && echo EXEC OK || echo EXEC ERR";./bad_cmd;eval $STRING'
/bin/bash: ./bad_cmd: No such file or directory
mksh have not the same behavior than ksh (and bash)
return code must be different than 0 for this eval of a bad cmd
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 unable to address this
request at this time.
Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.
Note that this is fixed in later mksh versions.
When Red Hat shipped 6.8 on May 10, 2016 RHEL 6 entered Production Phase 2.
That means only "Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released"
This BZ is now going to be closed as it does not appear to meet Phase 2 criteria.
If this BZ is deemed critical please open A support case in teh Red Hat Customer Portal and ask that this BZ be re-opened so it can be evaluated for 6.9.