Xsession and .bash_profile
Once upon a time I fought the good battle trying to get one of [gkwx]dm to run a login shell, because you know, we're logging in. I wanted it to run a login shell so I could run keychain or something.
Well today I wanted to figure out how to keep startx from running keychain.
It shouldn't have been running keychain because keychain runs from
.bash_profile which shouldn't be sourced for two good reasons: A) it's not a
login shell (this is a boot script to start freevo), and B) it's not bash,
it's /bin/sh (yes, I know that's really bash but when invoked as sh it doesn't
source .bash_profile).
It turns out some bright kid created /etc/X11/Xsession.d/91source_profile (I
think that's what it was called), that sourced every profile file it could
think of whenever Xsession was run. This is both bad and stupid. It's bad
because sometimes an X session is not a login. It's stupid because they could
have achieved the same thing in a more elegant way by adding --login to the
shebang line of /etc/X11/Xsession. The place to do login shell stuff is where
you actually log in, i.e. [xgkw]dm, not Xsession.
Please, my friends, if you go out into the world and work on something that involves login and environment, read the manpages and understand what a login shell, an interactive shell, and a noninteractive nonlogin shell are and when you want each. Thanks. End of rant.
Posted in linux | no comments | atom