[sclug] puzzle: including ~/bin in $PATH

Roland Turner SCLUG raz.fpyht.bet.hx at raz.cx
Tue Nov 29 09:10:42 UTC 2005

On Mon, 2005-11-28 at 22:27 +0000, John Stumbles wrote:

> If I do
> 	echo 'touch bash_profile_woz_ere' >> /home/test/.bash_profile
> and start a kde session as user 'test' on my kubuntu hoary machine I get 
> a 'bash_profile_woz_ere' file creates as kde starts up. If I do it on 
> debian sarge I don't.

This is a Kubuntu bug/misfeature. X session managers are definitely
_not_ supposed to cause a login shell to be instantiated at startup. In
particular, this would rob you of the ability to seperate login-with-X
and login-without-X behaviour, short of some nasty special-casing in
your .bash_profile.

> So it seems that under kubuntu kde is executing .bash_profile.
> I've trawled through all the likely-looking kde-related files I can find 
> (find / -xdev -name 'kde*') on the kubuntu machine for anything 
> accessing .bash_profile, but in vain. Surely it's not compiled into 
> kubuntu's kde build .... ?

No. Somewhere Kubuntu's KDE session manager is invoking a login shell,
either by manipulating argv[0][0] in an explicit exec() call, or by
adding the -l/--login argument to the first line of a shell script
somewhere. For the sake of a concrete example, one way to do this might
be to set the first line of /usr/bin/kde-session-manager (I made that
name up; don't know the real one, and don't even know whether it's a
shell script) from

    #! /bin/sh


    #! /bin/bash -l

There are many other approaches.

But again, to answer the original question, the place to set Bash's PATH
is ~/.bashrc, not ~/.bash_profile. The place to set a PATH for the whole
of an X session is session-manager specific.

- Raz

More information about the Sclug mailing list