[Tcsh] Filename substitution test: ~ vs ~user vs $HOME

Leonardo Taccari iamleot at gmail.com
Tue May 14 15:53:57 UTC 2019

Hello to the entire tcsh community,
when running tcsh tests with the HOME environment variable set to
an existent directory but not the user's home_dir passwd(5) field,
the `132: Filename substitution' test fails:

 | % env HOME=/tmp make check
 | [...]
 | 132: Filename substitution                           FAILED (subst.at:57)
 | [...]

The test does the following:

 | echo "echo ~$(id -un)/foo; echo \"$HOME/foo\"" | tcsh -f | uniq | wc -l | tr -d ' \t'

Because we inject $HOME environment variable `~$(id -un)' is expanded
to the home_dir passwd(5) field that's different from $HOME
(and `~', that it is also expanded to $HOME environment variable).

I think that the test case is actually problematic: we have no
guarantee - if $HOME is defined - that `~$(id -un)' is expanded to

Instead of using $HOME the test can use ~\$user so the results are
consistent also if $HOME environment variable is set.  If there are any
other suggestions please let me know!

A possible patch is attached to adjust the test to use ~\$user
instead of $HOME (the problem was discovered when invoking tests
on pkgsrc shells/tcsh package because pkgsrc inject a fake $HOME).

Thank you!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: subst-fakehomedir-fix.patch
Type: text/x-diff
Size: 715 bytes
Desc: subst-fakehomedir-fix.patch
URL: <https://mailman.astron.com/pipermail/tcsh/attachments/20190514/031e5c37/attachment.bin>

More information about the Tcsh mailing list