Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] My $PATH is problematic - How to fix it?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
cgmd
Veteran
Veteran


Joined: 17 Feb 2005
Posts: 1585
Location: Louisiana

PostPosted: Thu Sep 22, 2005 1:43 am    Post subject: [Solved] My $PATH is problematic - How to fix it? Reply with quote

Hi all...

I happened to check my command PATH earlier today ans was shocked to find the length of it as well as some duplication. :( :
Code:
~ $ echo $PATH
/usr/kde/3.4/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3.6:/usr/i386-pc-linux-gnu/gcc-bin/3.3... ..:/opt/blackdown-jdk-1.4.2.02/bin:/opt/blackdown-jdk-1.4.2.02/jre/bin:/usr/qt/3/bin:/usr/kde/3.4/bin:/home/cgmd/bin:/home/cgmd/bin


I have double instances of "/home/cgmd/bin", the second instance occurring when I echo $PATH in a kde terminal window but not in console.

Could someone please tell me how I might go about reducing this list? My PATH statement in ~/.bashrc is simply:
Code:
PATH=$PATH:/home/cgmd/bin


I have no idea how to pare this down. :?

Would someone please give me some pointers?

Thanks...
_________________
"Primum non nocere" ---Galen


Last edited by cgmd on Fri Oct 07, 2005 5:57 pm; edited 1 time in total
Back to top
View user's profile Send private message
Nil_Spaar
Apprentice
Apprentice


Joined: 10 Jul 2004
Posts: 179
Location: Berlin, Germany

PostPosted: Thu Sep 22, 2005 2:37 am    Post subject: Reply with quote

Afaik you should change PATH in ~/.bash_profile rather than ~/.bashrc because the first is only read by a login shell and the second only by non-login shell (but usually sourced by .bash_profile so in effect always read). So that statement gets executed once when you login and again when the bash in your kde terminal window is started hence you have it twice in your path.
The usual setup (under Gentoo) is that login shells source /etc/profile (which in turn sources /etc/bash/bashrc) and then source ~./.bash_profile (which sources ~/.bashrc). Non-login shells source the bashrc files but not the profile ones. (This is from memory. Look at "man bash" under INVOCATION for exact details).
Your path is set in /etc/profile which takes that info from /etc/profile.env which is generated by env-update from the files in /etc/env.d/. But (unless you know what you are doing) you shouldn't mess with those files by hand since they are put there by the respective packages and with good reason. Since many packages install executables in non-standard places a rather long PATH is needed. (Mine is /home/christian/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3.6:/opt/blackdown-jdk-1.4.2.02/bin:/opt/blackdown-jdk-1.4.2.02/jre/bin:/usr/qt/3/bin:/usr/kde/3.4/bin:/usr/games/bin atm.)
The only strange things about your PATH as far as I can see are

  • double /home/cgmd/bin
    (see above)
  • double /usr/kde/3.4/bin
    no idea really, look at the kde related files in /etc/env.d
  • the i386-pc-linux-gnu path
    strange, but I think I dimly remember having that one too some time ago, might be a leftover from first installation or a less than perfect gcc-upgrade. Look for the file that contains that stuff and if the things there seem obsolete (e.g. they point to directories that don't exist) then I guess it would be save to just remove it.
Back to top
View user's profile Send private message
cgmd
Veteran
Veteran


Joined: 17 Feb 2005
Posts: 1585
Location: Louisiana

PostPosted: Thu Sep 22, 2005 3:20 am    Post subject: Reply with quote

Nil_Spaar wrote...

Quote:
you should change PATH in ~/.bash_profile rather than ~/.bashrc


That advice was correct, in so far as eliminating the duplication of /home/cgmd/bin after changing to ~/.bash_profile for the PATH statement. Thank you so much! :)

The duplication of /usr/kde/3.4/bin is, as yet, still a problem.

[Edit]... I found the following in /etc/env.d:
Code:
/etc/env.d $ cat 46kdepaths-3.4
PATH=/usr/kde/3.4/bin
ROOTPATH=/usr/kde/3.4/sbin:/usr/kde/3.4/bin
LDPATH=/usr/kde/3.4/lib
CONFIG_PROTECT="/usr/kde/3.4/share/config /usr/kde/3.4/env /usr/kde/3.4/shutdown"

...but I see nothing wrong with it.

search for i386-pc-linux-gnu related files turned up only the following:
Code:
locate i386-pc-linux-gnu
/usr/bin/i386-pc-linux-gnu-c++
/usr/bin/i386-pc-linux-gnu-g++
/usr/bin/i386-pc-linux-gnu-gcc
/usr/lib/ccache/bin/i386-pc-linux-gnu-c++
/usr/lib/ccache/bin/i386-pc-linux-gnu-g++
/usr/lib/ccache/bin/i386-pc-linux-gnu-gcc
/usr/lib/gcc-lib/i386-pc-linux-gnu
/usr/lib/gcc-lib/i386-pc-linux-gnu/3.3.4
/usr/lib/gcc-lib/i386-pc-linux-gnu/3.3.4/libstdc++.la
/usr/share/gcc-data/i386-pc-linux-gnu
/usr/share/gcc-data/i386-pc-linux-gnu/3.3
/usr/share/gcc-data/i386-pc-linux-gnu/3.3/info
/usr/share/gcc-data/i386-pc-linux-gnu/3.3/info/dir.old


I don't have enough experience to know whether that path can be safely removed... :? Any thoughts?

Thanks, Nil_Spaar, for the fast response!
_________________
"Primum non nocere" ---Galen
Back to top
View user's profile Send private message
Nil_Spaar
Apprentice
Apprentice


Joined: 10 Jul 2004
Posts: 179
Location: Berlin, Germany

PostPosted: Wed Oct 05, 2005 3:19 am    Post subject: Reply with quote

cgmd wrote:

The duplication of /usr/kde/3.4/bin is, as yet, still a problem.

[Edit]... I found the following in /etc/env.d:
Code:
/etc/env.d $ cat 46kdepaths-3.4
PATH=/usr/kde/3.4/bin
ROOTPATH=/usr/kde/3.4/sbin:/usr/kde/3.4/bin
LDPATH=/usr/kde/3.4/lib
CONFIG_PROTECT="/usr/kde/3.4/share/config /usr/kde/3.4/env /usr/kde/3.4/shutdown"

...but I see nothing wrong with it.

That looks ok and in fact I have the same file here. Look at /etc/profile.env. If it's double in the PATH variable there then something's wrong with the files in /etc/env.d. Maybe another one sets that kde path. Try greping those files for "kde" and see what turns up. If it isn't double in /etc/profile.env then something strange is going on and unless you accidently add it in your ~/.bash* files (which I doubt ;) ) I have no clue what's doing this.

cgmd wrote:

search for i386-pc-linux-gnu related files turned up only the following:
Code:
locate i386-pc-linux-gnu
[...]

I don't have enough experience to know whether that path can be safely removed... :? Any thoughts?

Well in you PATH it says "/usr/i386-pc-linux-gnu/gcc-bin/3.3...". Check if that path really exists. If it does then better don't change it but if it doesn't it should be save to remove that from PATH.
I for example have
Code:

05:13:29 root@amber:/etc/env.d # cat 05gcc
PATH="/usr/i686-pc-linux-gnu/gcc-bin/3.3.6"
ROOTPATH="/usr/i686-pc-linux-gnu/gcc-bin/3.3.6"
MANPATH="/usr/share/gcc-data/i686-pc-linux-gnu/3.3.6/man"
INFOPATH="/usr/share/gcc-data/i686-pc-linux-gnu/3.3.6/info"
LDPATH="/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6"
GCC_SPECS=""

and I guess you have a similar file. But there's probably another file with a similar name that has similar entries but with i386 instead of i686. That would be the one to delete.

cgmd wrote:
Thanks, Nil_Spaar, for the fast response!

Sorry for taking so long to come back to this.
Back to top
View user's profile Send private message
cgmd
Veteran
Veteran


Joined: 17 Feb 2005
Posts: 1585
Location: Louisiana

PostPosted: Thu Oct 06, 2005 9:40 pm    Post subject: Reply with quote

Nil_Spaar wrote...

Quote:
Well in you PATH it says "/usr/i386-pc-linux-gnu/gcc-bin/3.3...". Check if that path really exists.


I checked, and "/usr/i386-pc-linux-gnu/" doesn't exist. So... I agree it can probably be safely removed.

Next question... How do I remove it from the path?

Thanks...
_________________
"Primum non nocere" ---Galen
Back to top
View user's profile Send private message
Nil_Spaar
Apprentice
Apprentice


Joined: 10 Jul 2004
Posts: 179
Location: Berlin, Germany

PostPosted: Thu Oct 06, 2005 11:31 pm    Post subject: Reply with quote

cgmd wrote:

I checked, and "/usr/i386-pc-linux-gnu/" doesn't exist. So... I agree it can probably be safely removed.
Next question... How do I remove it from the path?


Nil_Spaar wrote:

I for example have
Code:

05:13:29 root@amber:/etc/env.d # cat 05gcc
PATH="/usr/i686-pc-linux-gnu/gcc-bin/3.3.6"
ROOTPATH="/usr/i686-pc-linux-gnu/gcc-bin/3.3.6"
MANPATH="/usr/share/gcc-data/i686-pc-linux-gnu/3.3.6/man"
INFOPATH="/usr/share/gcc-data/i686-pc-linux-gnu/3.3.6/info"
LDPATH="/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6"
GCC_SPECS=""

and I guess you have a similar file. But there's probably another file with a similar name that has similar entries but with i386 instead of i686. That would be the one to delete.
Back to top
View user's profile Send private message
cgmd
Veteran
Veteran


Joined: 17 Feb 2005
Posts: 1585
Location: Louisiana

PostPosted: Fri Oct 07, 2005 11:19 am    Post subject: Reply with quote

Nil_Spaar...

After a little poking around, this is where I believe the culprit to be:
Code:
/etc/env.d $ cat 05gcc-i686-pc-linux-gnu
PATH="/usr/i386-pc-linux-gnu/gcc-bin/3.3"
ROOTPATH="/usr/i386-pc-linux-gnu/gcc-bin/3.3"


As you see, /usr/i386-pc-linux-gnu/gcc-bin/3.3 is within "05gcc-i686-pc-linux-gnu", not in "05gcc" ... :?

Do you likewise have a 05gcc-i686-pc-linux-gnu listing in your /etc/env.d dir?

If not, perhaps it would be safe for me to remove the entire 05gcc-i686-pc-linux-gnu file, since it contains the nonexistent path?

Thanks, once again...
_________________
"Primum non nocere" ---Galen
Back to top
View user's profile Send private message
Nil_Spaar
Apprentice
Apprentice


Joined: 10 Jul 2004
Posts: 179
Location: Berlin, Germany

PostPosted: Fri Oct 07, 2005 1:04 pm    Post subject: Reply with quote

You know it sometimes helps immensely to actually read what I wrote. So let's do that step by step:
"I for example have: /etc/env.d # cat 05gcc [stuff with 686 entries]" <-- that's the good file with the correct entries
"and I guess you have a similar file."
"But there's probably another file with a similar name" <-- your 05gcc-i686-pc-linux-gnu file seems to match that description
"that has similar entries but with i386 instead of i686." <-- wow and again your 05gcc-i686-pc-linux-gnu seems to match
"That would be the one to delete." <-- well I guess what I meant by this is, yes you can delete the 05gcc-i686-pc-linux-gnu file since it contains invalid data
Back to top
View user's profile Send private message
cgmd
Veteran
Veteran


Joined: 17 Feb 2005
Posts: 1585
Location: Louisiana

PostPosted: Fri Oct 07, 2005 5:56 pm    Post subject: Reply with quote

Nil_Spaar wrote:

Quote:
You know it sometimes helps immensely to actually read what I wrote


I know I'm not the best pupil, but I do appreciate the patience of Nil_Spaar and other forum members who try to help me through the gentoo learning process... :)

At any rate, my command path is now cleaner and all systems seem to be working well!

Thanks for helping!
_________________
"Primum non nocere" ---Galen
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum