Bug 89620 - Appending to $PATH in ~/.cshrc produces duplicates entries
Summary: Appending to $PATH in ~/.cshrc produces duplicates entries
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: tcsh
Version: 8.0
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Miloslav Trmač
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-04-25 03:41 UTC by Bill Heiden
Modified: 2007-04-18 16:53 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-08-19 18:10:53 UTC
Embargoed:


Attachments (Terms of Use)

Description Bill Heiden 2003-04-25 03:41:31 UTC
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)
endif

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
o/bar

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-25 03:49:28 UTC
 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 22:27:45 UTC
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 18:10:53 UTC
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
question.


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