startup, .profile, env.vars., etc.

Ryo Furue furue at hawaii.edu
Thu May 29 20:15:44 BST 2008


Hi Kevin,

Thank you for your response.

| > But, today I realized that without a link in ~/.kde/env/ , my
| > ~/.bash_profile is somehow sourced.  My system is the testing
| > distribution of Debian, which is constantly updated, and KDE has
| > been updated for a few times since I set ~/.kde/env/ , I think.
| > Does that mean that KDE now sources the user's ~/.profile ?
| 
| No.
| However the shell running startkde might read files during its
| startup, e.g. bash reads different files depending on if it is
| started as a login shell, non-interactive shell, interactive shell,
| etc. 
| 
| Thus running startkde manually from a console might get you a
| different environment than having it started through KDM, GDM, etc.

I know all these!  That's why I was surprised.  (I use KDM.)

To surprise you too :-), I've added the following line in my
.bash_profile

    export HELLO_KEVIN="Hi, How are you?"

and I restarted the machine (not only KDE but the entire Linux
system).  I then logged in from KDM.  Look at this:

  $ ls -lA .kde/env
  total 0
  $ env | egrep HELLO
  HELLO_KEVIN=Hi, How are you?
  $ su -
  Password:
  # ps -ef | egrep kicker
  furue     3884     1  0 08:42 ?        00:00:00 kicker [kdeinit]                
  root      4056  4033  0 08:43 pts/0    00:00:00 egrep kicker
  # cat /proc/3884/environ | tr '\0' '\n' | egrep HELLO
  HELLO_KEVIN=Hi, How are you?
  #

Not only konsole but also kicker gets my env.var.  I also found that
the process "/bin/sh /usr/bin/startkde" has the env.var. HELLO_KEVIN,
too (not shown above).  Since I use KDM, there's no chance that my own
evn.vars. are fed back to the KDE system, unless the KDE system sources
my .bash_profile .

I'm positive that my .bash_profile is sourced only when the bash is a
login shell:

   $ unset HELLO_KEVIN
   $ echo $HELLO_KEVIN

   $ bash
   $ echo $HELLO_KEVIN

   $ exit
   exit
   $ bash -l
   $ echo $HELLO_KEVIN
   Hi, How are you?
   $ exit
   logout
   $                                                

Seeing all these, the only conclusion I can reach is that the KDE
system sources my .bash_profile somewhere during its startup process
even when ~/.kde/env/   is empty.  Oh, and

   $ kde-config --path exe
   /home/amakihi/furue/.kde/bin/:/usr/bin/
   $ echo $HOME
   /home/amakihi/furue
   $

(Thanks for the command! )
As you can see, there's no other source than ~/.kde/env/
(And, of course, I'm not as crazy as to edit /usr/etc/ :-)

| I think the safest way is to use the environment extender mechanism
| or to set the variables as a point prior to KDE startup,
| i.e. whereever the distribution sets globally used environment
| variables.

Right, but currently the environment extender mechanism seems to be
redundant.  Since I use KDM, there's no point prior to KDE startup
that an ordinary user can control.

| To check how the  variables of the KDE session are set, you can execute a 
| command through "Run Command" (or ALT+F2), like this
| 
| env > /tmp/kdeenv.txt

Thanks!  I did that, and here's the result:

    $ egrep HELLO /tmp/kdeenv.txt
    HELLO_KEVIN=Hi, How are you?
    $

Cheers,
Ryo
___________________________________________________
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