Hide Forgot
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); }
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