Skip to content
Commit ac80e77f authored by Simon McVittie's avatar Simon McVittie Committed by Ondrej Holy
Browse files

Accept XDG_RUNTIME_DIR/bus as a valid D-Bus session/user bus

These checks for DBUS_SESSION_BUS_ADDRESS were added to solve
https://bugzilla.gnome.org/show_bug.cgi?id=526454,
in which non-X11-session processes (for example a system service),
or processes under su or similar inside an X11 session, could cause
a dbus-daemon to be autolaunched via dbus-launch. If there was no
X11 display to represent the lifetime of a session, the dbus-daemon
would potentially run forever, causing a "leaked" process;
additionally, other uses of D-Bus by the same uid would start more
dbus-daemons.

This becomes potentially problematic on systems with the "user bus"
model introduced in dbus 1.10: libdbus, GDBus and sd-bus will now
all try the per-uid socket XDG_RUNTIME_DIR/bus before attempting
autolaunch, so if those are known to be the only implementations in
use on a "legacy-free" system, setting DBUS_SESSION_BUS_ADDRESS is
unnecessary. Check for that socket before giving up.

XDG_RUNTIME_DIR/bus as implemented by dbus 1.10 with systemd avoids
several of the down sides of autolaunching: it will never start more
than one session bus per uid, and the socket and bus will automatically
be cleaned up when the corresponding "systemd --user" exits.

https://bugzilla.gnome.org/show_bug.cgi?id=756420
parent d2362572
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment