shreevatsa.public at gmail.com
Wed Jan 16 14:37:35 PST 2008
On Jan 16, 2008 5:08 PM, Colin Walters <walters at verbum.org> wrote:
> On Jan 16, 2008 5:01 PM, Shreevatsa R <shreevatsa.public at gmail.com> wrote:
> > Hi,
> > My current understanding is this:
> > When a D-Bus-using program is started,
> > (a) if DBUS_SESSION_BUS_ADDRESS is set, it uses that bus
> Applications can choose to connect to the session or system bus.
Right, I should I have said "When a D-Bus-session-bus-using program is started".
> > (b) else, it invokes dbus-launch --autolaunch. This will:
> libdbus certainly doesn't try to spawn a bus for you, because that
> would generally be wrong.
Are you sure?
At least a few programs seem to do this [
and even the "AUTOMATIC LAUNCHING" section of the manpage for
"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-
which was essentially what I quoted. That whole section seems to
indicate that libdbus does indeed start new buses, and the last
"The --autolaunch option is considered an internal implementation detail
of libdbus, and in fact there are plans to change it. There's no real
reason to use it outside of the libdbus implementation anyhow."
which, if programs followed, would mean that it was only libdbus doing
the launching... but perhaps it is not. Either way, new dbus-daemon
processes *do* seem to get spawned when I call certain programs
without having DBUS_SESSION_BUS_ADDRESS set.
> > Now, I am on OS X, and not running X11 [...]
> > So my question is: How do I launch dbus and have the session bus
> > address available to all programs that are launched later?
> The way it works on Unix/Linux/X11 is typically that it runs as part
> of a "session startup" script. I have no idea how this works on OS X,
> but you should try to find out what the place is where any
> subprocesses will inherit the environment variable.
> There is also the detail that babysitting using the X connection
> doesn't really work if you're not running X...ideally the dbus-launch
> script would have support for monitoring an OS X login session and
> terminating when it closes.
I haven't tried hard enough to find it, but ideally there would be a
way for D-Bus to find its running bus without depending on things like
X. I should be able to call dbus-launch, have the bus started, and
available (and findable) to all programs while it's running. The "file
in ~/.dbus/sesion-bus/" looks like it's a way to do this, really; can
anyone tell me about it?
More information about the dbus