Bug 802565 - Tilda expansion failing in ksh
Tilda expansion failing in ksh
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: ksh (Show other bugs)
Unspecified Unspecified
urgent Severity urgent
: rc
: ---
Assigned To: Michal Hlavinka
Martin Kyral
: Patch, ZStream
Depends On:
Blocks: 727267 805459
  Show dependency treegraph
Reported: 2012-03-12 17:09 EDT by Peter Fales
Modified: 2013-01-08 02:21 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1264077 (view as bug list)
Last Closed: 2013-01-08 02:21:46 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Peter Fales 2012-03-12 17:09:23 EDT
Description of problem:

Tilda expansion fails to take place under certain conditions

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.  create the following script:  (here ~root/bin/date is just a copy of 

    echo $(~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 @@
                logins_tree = dtopen(&_Nvdisc,Dtbag);
+       {
+               c = shp->subshell;
+               shp->subshell = 0;
                nv_putval(np, pw->pw_dir,0);
+               shp->subshell = c;
+       }
Comment 1 Michal Hlavinka 2012-03-13 05:30:47 EDT
Reproducible and I can confirm that patch fixes this issue.

Modified reproducer:
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 ];
  echo "bug fixed"
  echo "bug present"
rm -rf ${TMPDIR}
exit $rc
Comment 13 errata-xmlrpc 2013-01-08 02:21:46 EST
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.


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