Red Hat Bugzilla – Bug 89620
Appending to $PATH in ~/.cshrc produces duplicates entries
Last modified: 2007-04-18 12:53:18 EDT
Description of problem: Appending entries to $path via ~/.cshrc will produce
Version-Release number of selected component (if applicable):
How reproducible: 100%
Steps to Reproduce:
1. Modify ~/.cshrc to add additional paths:
if ($?path) then
set path = ($path /foo/bar)
2. Logout and back into the modified account and see the repeated enteries.
/usr/local/bin /usr/bin /bin /usr/X11R6/bin /foo/bar /usr/X11R6/bin /foo/bar /fo
/usr/local/bin /usr/bin /bin /usr/X11R6/bin /foo/bar
Additional info: This can be avoided by explicitly setting $path in ~/.cshrc,
but that is not the behavior that we expect. This really ends up complicating
matters if you have a relatively complex path or are trying to create paths
based on self-defined environment settings. This also poses problems when the
default system path changes from release to release (which it has). If we need
to explicitly test for OS release before setting the path, then this adds
another layer of complexity. Why is ~/.cshrc being sourced twice before the
actual shell is being opened and why are the settings being propagated to the
fresh shell? Please be aware we have a relatively complex production
environment and this behavior does not make the job any easier.
BTW, we can live with the duplicate entry for /usr/X11R6/bin since it is only a
And I forgot to add, since we are working heterogenous environment this also
makes the development of standard dotfiles that more complicated.
I'm not sure this is a bug. It is just the way csh variables work.
If I do
set x = (y)
set x = ($x y)
set x = ($x y)
then x becomes equal to 'y y y'. The bash PATH environment variable
works the same way. I know it's complicated but I usually do
echo $PATH | grep -Fq "$HOME/bin"
if ($status) then
set path = (/usr/local/bin $path $HOME/bin)
in my scripts.
I can't reproduce this behavior.
If you still experience this with a recent release, please provide
output files of (strace -ff -o log tcsh) for the tcsh process in