KDE menus (Lancelot, Kmenu, Krunner) not respecting PATH?

Boyd Stephen Smith Jr. bss at iguanasuicide.net
Thu May 7 20:23:46 BST 2009


In <4A032D67.3080703 at acm.org>, James Richard Tyrer wrote:
>Boyd Stephen Smith Jr. wrote:
>> Yes, I think some distributions misguidedly source .bash_profile and/or
>> .bashrc at odd times.
>The "Xsession" script needs to source the proper profile script for the
>shell that you are using (.bash_profile for Bash).  It can do this
>either explicitly or implicitly by being a login script.

No, because an Xsession is not a bash login.  It is an X login.  ~/.xprofile 
and /etc/xprofile would be appropriate, ~/.bash_profile is not.  Just like 
tcsh and zsh don't read .bash_profile (or bash vice-versa), your Xsession 
doesn't (necessarily) *have* a login shell (it is the login process and 
doesn't have to be a shell script) so it should not read your .bash_profile.

>> Sourcing .bash_profile (or .profile) is a bit dangerous, as they are
>> allowed to be fully interactive.  On some systems, I have my
>> .bash_profile prompt me and depending on my response possibly 'exec
>> screen'.
>If you read the fine man page for BASH, you will see that
>".bash_profile" is the script for login.  It should not be interactive.

It is sourced for interactive bash logins.  It is allowed to be interactive 
itself -- even something that using 'exec' to replace the bash process with 
something else.  But also less outlandish tasks that require a attached 
working terminal with a human on the other side, for example prompting for a 
ssh- or gpg-key passphrase.

Your .bash_profile is allowed to be interactive and any system that assumes 
it is not is broken.

>> Sourcing .bashrc is less dangerous, since (because of historical
>> problems) it shouldn't consume input or produce output most of the time.
>But, that isn't relevant since it isn't what is sourced for login.  IAC,
>that would be wrong.  The environment should be set in the profile
>script, not the resource script.

No, because you generally want the environment to affect all interactive 
bash shells even if they are not bash login shells, like bash started inside 
an xterm or a shell running from inside mutt/vim.

Generally, your .bash_profile should read your .bashrc (the bash man- and 
info-pages recommend it).  However, .bash_profile can also do things that 
you would only want to happen once a login.  (e.g. print the MOTD, unlock 
your keychain, or replace your shell with GNU Screen)
-- 
Boyd Stephen Smith Jr.           	 ,= ,-_-. =.
bss at iguanasuicide.net            	((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy 	 `-'(. .)`-'
http://iguanasuicide.net/        	     \_/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde/attachments/20090507/6f3a4522/attachment.sig>
-------------- next part --------------
___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.


More information about the kde mailing list