[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: $PATH and /etc/profile



Bob Proulx wrote:
> Sam Halliday wrote:
> > Bob Proulx wrote:
> > > By starting a login shell.  Create ~/.xsession with the following:
> > > 
> > >   #!/bin/bash --login
> > >   exec x-session-manager # or gnome-session or whatever.
> > 
> > AAAARG! you can't be serious!! .xsession as a LOGIN shell??
> > repeat after me... X windows is not your shell!
> 
> Yes, I am very serious.  Please tell me why you are so adamantly
> opposed to this.  (Other than it being poorly documented and
> confusing.  I completely agree there.)
> 
>   9.7.  KDE (kdm) does not read my .bash_profile!".  The login
>         managers xdm and kdm do not run a login shell, so .profile,
>         .bash_profile, etc. are not sourced.  When the user logs in,
>         xdm runs Xstartup as root and then Xsession as user.  So the
>         normal practice is to add statements in Xsession to source the
>         user profile.  Please edit your Xsession and .xsession files.

this says exactly what i said.

> > if however, you login via kdm/gdm/xdm, it is NOT a login shell, so
> > /etc/profile is not read. there are good reasons for this. if you do
> > not agree with these good reasons, then you can simply add the line
> >   . /etc/profile
> > to your ~/.xsession file.
> 
> Negative.  That won't get your ~/.bash_profile, or .login with csh,
> sourced.

so source all the files you want sourced. you should not source bashrc as it
should contain bash interactive shell specific stuff (like functions and aliases
which do not get inherited anyway). you should only source POSIX compliant shell
stuff if you are using a POSIX shell. you could change your .xsession's shell
however and source csh files. i have never done that. non-POSIX shells are the
devil.

> Also your vehemence at opposing the .xsession as a login shell, and
> then proposing that it simply source the /etc/profile, seems
> completely inconsistent to me.  Why do you oppose sourcing the file
> and then propose sourcing the file!  My turn for an, "AAAARG!"  :-)

sourcing /etc/profile is not equivalent to logging in. logging in will do more
than that.

> [Darn, I really wish you had suggested sourcing the ~/.bash_profile or
> ~/.bashrc files in the /etc/Xsession* script.  Because that is
> definitely wrong and I would have a serious rebuttal.  :-)

:-) yes, it is... for the reasons i said above. sourcing ~/.profile would be a
good idea though, and i do that.

> > in his solution you will be seen to be logged in twice.
> 
> What are you talking about here?  Logged in twice?  Please explain.
> Because I think you are the one way off base here.  I think you are
> confused about what it means to be a login shell.

i was wrong here... debian must do something as on my LFS system last year
(standard X scripts) this would count as a double login. probably a workaround
because they seen so many people were doing this kind of thing.

in fact... do a `grep -R sessreg /etc` to see what debian do. they exec any
sessreg calls, so that stamps out any double logins. thats that puzzle sorted
out!

however, on most systems (eg SunOS, *BSD, other GNU/Linux) having .xsession be a
login shell would count as a double login.



Reply to: