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

Christos Zoulas christos at zoulas.com
Wed May 15 00:13:12 UTC 2019


I am not sure if that's worth fixing because also the cdtohome test fails then.
Perhaps the tests should reset $HOME or $home to the default instead?

christos

> On May 14, 2019, at 11:53 AM, Leonardo Taccari <iamleot at gmail.com> wrote:
> 
> 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
> ${HOME}.
> 
> 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!
> <subst-fakehomedir-fix.patch>-- 
> Tcsh mailing list
> Tcsh at astron.com
> https://mailman.astron.com/mailman/listinfo/tcsh



More information about the Tcsh mailing list