Bug 89620 - Appending to $PATH in ~/.cshrc produces duplicates entries
Appending to $PATH in ~/.cshrc produces duplicates entries
Product: Red Hat Linux
Classification: Retired
Component: tcsh (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Miloslav Trmač
Depends On:
  Show dependency treegraph
Reported: 2003-04-24 23:41 EDT by Bill Heiden
Modified: 2007-04-18 12:53 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-08-19 14:10:53 EDT
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 Bill Heiden 2003-04-24 23:41:31 EDT
Description of problem: Appending entries to $path via ~/.cshrc will produce 
duplicate enteries.  

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.

Actual results:

/usr/local/bin /usr/bin /bin /usr/X11R6/bin /foo/bar /usr/X11R6/bin /foo/bar /fo

Expected results:

/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 
minor annoyance.
Comment 1 Bill Heiden 2003-04-24 23:49:28 EDT
 And I forgot to add, since we are working heterogenous environment this also 
makes the development of standard dotfiles that more complicated. 
Comment 2 Stephen Walton 2003-12-19 17:27:45 EST
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
something like:

echo $PATH | grep -Fq "$HOME/bin"
if ($status) then
   set path = (/usr/local/bin $path $HOME/bin)

in my scripts.
Comment 3 Miloslav Trmač 2004-08-19 14:10:53 EDT
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

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