GDBus: try XDG_RUNTIME_DIR/bus before resorting to dbus-launch

This is the right thing to do for the "a session is a user-session"
model implemented in dbus 1.9.14, which is described in
<http://lists.freedesktop.org/archives/dbus/2015-January/016522.html>.

It also resembles sd-bus' behaviour, although sd-bus will only try
kdbus and XDG_RUNTIME_DIR/bus, and never runs dbus-launch.

On systems following the more traditional "a session is a login-session"
model, X_R_D/bus won't exist, so it is harmless to check for it before
falling back to X11 autolaunching. Again, this matches the behaviour
of current libdbus and sd-bus versions.

Now that we do this, g_test_dbus_unset() needs to clear XDG_RUNTIME_DIR
as well as everything else.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=747941
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
This commit is contained in:
Simon McVittie
2015-04-15 17:57:29 +01:00
parent 0d3f56e31c
commit 32492c6ab0
2 changed files with 69 additions and 0 deletions

View File

@@ -838,4 +838,6 @@ g_test_dbus_unset (void)
g_unsetenv ("DBUS_SESSION_BUS_ADDRESS");
g_unsetenv ("DBUS_STARTER_ADDRESS");
g_unsetenv ("DBUS_STARTER_BUS_TYPE");
/* avoid using XDG_RUNTIME_DIR/bus */
g_unsetenv ("XDG_RUNTIME_DIR");
}