| Summary: | Tilda expansion failing in ksh | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 5 | Reporter: | Peter Fales <redhat.com> | |
| Component: | ksh | Assignee: | Michal Hlavinka <mhlavink> | |
| Status: | CLOSED ERRATA | QA Contact: | Martin Kyral <mkyral> | |
| Severity: | urgent | Docs Contact: | ||
| Priority: | urgent | |||
| Version: | 5.8 | CC: | jwest, lmiksik, mkyral, ovasik, pmuller, prc, redhat.com, rnelson | |
| Target Milestone: | rc | Keywords: | Patch, ZStream | |
| Target Release: | --- | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | Doc Type: | Bug Fix | ||
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 1264077 (view as bug list) | Environment: | ||
| Last Closed: | 2013-01-08 07:21:46 UTC | Type: | --- | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Bug Depends On: | ||||
| Bug Blocks: | 727267, 805459 | |||
Reproducible and I can confirm that patch fixes this issue.
Modified reproducer:
#!/bin/ksh
cd ${HOME}
TMPDIR=$(mktemp -d test-XXXXXX)
cp /bin/echo ${HOME}/${TMPDIR}/echo
if [ "$(~${USER}/${TMPDIR}/echo OK)$(~${USER}/${TMPDIR}/echo OK)$(~${USER}/${TMPDIR}/echo OK)" = OKOKOK ];
then
echo "bug fixed"
rc=0
else
echo "bug present"
rc=1
fi
rm -rf ${TMPDIR}
exit $rc
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-2013-0042.html |
Description of problem: Tilda expansion fails to take place under certain conditions Version-Release number of selected component (if applicable): ksh-20100621-5.el5 How reproducible: Always Steps to Reproduce: 1. create the following script: (here ~root/bin/date is just a copy of bin/date) #!/usr/bin/ksh echo $(~root/bin/date) ~root/bin/date 2. Execute the script Actual results: The first line prints the date, the second line prints an error because ~root is not getting expanded: /tmp/ksh.bug[3]: ~root/bin/date: not found [No such file or directory] Expected results: Both lines should print the date. Additional info: If the second line is commented out, then tilda expansion correctly takes place in the third line and the date is printed. RHEL 5.8 has ksh93t+. The bug is also showing up in ksh93u+ and AT&T gave me this patch for 93u+: --- .../sh/macro.c Tue Feb 7 09:56:20 2012 +++ sh/macro.c Fri Mar 9 15:58:54 2012 @@ -2700,7 +2700,12 @@ if(!logins_tree) logins_tree = dtopen(&_Nvdisc,Dtbag); if(np=nv_search(string,logins_tree,NV_ADD)) + { + c = shp->subshell; + shp->subshell = 0; nv_putval(np, pw->pw_dir,0); + shp->subshell = c; + } return(pw->pw_dir); }