Bug#737488: glib2.0: please use dbus-run-session(1) instead of dbus-launch, or omit it entirely

Simon McVittie smcv at debian.org
Mon Feb 3 01:41:43 UTC 2014


Source: glib2.0
Version: 2.38.2-2
Severity: wishlist

glib2.0 currently runs tests wrapped in dbus-launch. However, dbus-launch
is not really designed to be run like that; you are likely to end up
with "orphaned" dbus-launch and dbus-daemon processes. (See the
diagram in its source code, or various dbus bugs, for the gory details.)

In D-Bus 1.8 I added a new tool, dbus-run-session(1), which is specifically
intended for wrapping around test suites. It might well be a drop-in
replacement for how 05_run-gio-tests-with-a-dbus-session.patch (ab)uses
dbus-launch.

Alternatively, it appears that these days the GLib tests are all meant
to run their own dbus-daemon via GTestDBus if they need one, so you
might not need to wrap them at all. If you want to make sure the tests
can't possibly touch the user's D-Bus session, use some incantation
like this:

    env \
        --unset=DISPLAY \
        --unset=DBUS_SESSION_BUS_PID \
        --unset=DBUS_SESSION_BUS_WINDOWID
        --unset=DBUS_STARTER_ADDRESS \
        --unset=DBUS_STARTER_BUS_TYPE \
        DBUS_SESSION_BUS_ADDRESS="oh-no-you-dont:" \
        --
        make check

(Setting DBUS_SESSION_BUS_ADDRESS to an invalid value instead of unsetting
it because unset is equivalent to a platform-dependent default, currently
"autolaunch:" on Unix.)

To be future-proof you might also want to set XDG_RUNTIME_DIR to a scratch
directory, or unset it (systemd/kdbus use it, and I might add a
XDG_RUNTIME_DIR-based transport to the default "search path" in libdbus
one day.)

Regards,
    S



More information about the pkg-gnome-maintainers mailing list