[PATCH] startkde and dbus-launch

Jos van den Oever jvdoever at gmail.com
Mon Dec 28 11:40:18 GMT 2009

2009/12/27 Thiago Macieira <thiago at kde.org>:
> Em Domingo 27. Dezembro 2009, às 19.16.33, Jos van den Oever escreveu:
>> You can at least remove the comment about autolaunch being broken,
>> since it is not broken. The problem is that when the dbus daemon is
>> not yet running (DBUS_SESSION_BUS_ADDRESS not set), each app trying to
>> talk to the daemon will start a new daemon.
> No, they won't.

>From 'man dbus-launch':

       If  DBUS_SESSION_BUS_ADDRESS is not set for a process that tries to use
       D-Bus, by default the process will attempt to invoke  dbus-launch  with
       the  --autolaunch  option  to  start  up  a new session bus or find the
       existing bus address on the X display or in a file in  ~/.dbus/session-

       Whenever  an autolaunch occurs, the application that had to start a new
       bus will be in its own little world; it can effectively end up starting
       a  whole new session if it tries to use a lot of bus services. This can
       be suboptimal or even totally broken, depending on the app and what  it
       tries to do.

So each app that is started in an environment where
DBUS_SESSION_BUS_ADDRESS is not set and where there is no existing bus
on the X display and where there is nothing in ~/.dbus/session-bus/
will be in 'its own little world'. The existing kdestart.cmake fixes
this but starting the dbus daemon and setting
DBUS_SESSION_BUS_ADDRESS before any applications are started. That way
all kde applications starting from kdestart.cmake use the same dbus

The change you introduce with the --autolaunch argument is that you
use a global machineid to infer the port of the dbus daemon. This
means that if you run kdestart as the same user on the same machine,
the applications started from either invocation will use the same dbus
I do not see a scenario where you would want to run startkde two
times, but your patch would make these two instances use only one dbus
daemon. I really cannot tell if that is desirable or not since I would
not know when to run startkde twice.

I can imagine a scenario where I run different kde apps from different
ssh sessions and would like them to use the same dbus daemon. For that
scenario it is still necessary to set DBUS_SESSION_BUS_ADDRESS by


More information about the kde-core-devel mailing list