Currently the session bus autolaunching will fail to execute dbus-launch if there's no $DISPLAY. The known use cases for autolaunching (ssh -Y firefox, run konqueror in legacy DE) all need $DISPLAY too, so it seems reasonable to return a nice error here rather than failing to run dbus-launch.
This came up in the case of the bzr-dbus plugin.
Relatedly, Maemo has a patch to disable autolaunching altogether, to force developers to set the GUI session's DBUS_SESSION_BUS_ADDRESS when logging into an embedded device over ssh. This avoids getting "split brain" problems when you run a GUI app from the ssh session for debugging.
Created attachment 43767 [details] [review]
[PATCH 1/2] Don't attempt Unix X11 autolaunching if DISPLAY isn't set
The known use cases for autolaunching (ssh -Y firefox,
run konqueror in legacy DE) all need $DISPLAY too.
Created attachment 43768 [details] [review]
[PATCH 2/2] Allow X11 autolaunch to be disabled even if the headers/libraries are there
In an embedded system where the D-Bus session is a core part of the
environment, like Maemo, accidentally auto-launching a second session bus
(for instance for a concurrent ssh session) is a bad idea - it can lead
to a "split brain" situation where half the applications in the GUI are
using a different bus. In these controlled environments, it'd be useful
to prevent autolaunch from ever happening.
(As a side benefit, the changes to configure.in also mean that packagers
can explicitly --enable-x11-autolaunch, to make sure that failure to find
X will make compilation fail cleanly.)
Both these patches look fine to me.
Created attachment 43795 [details] [review]
test-autolaunch: don't expect autolaunching to work if X11 is disabled
Created attachment 43796 [details] [review]
Check for X even if X11 autolaunching is disabled
DBUS_ENABLE_X11_AUTOLAUNCH obviously requires DBUS_BUILD_X11. However,
the converse is not true.
If DBUS_BUILD_X11 is defined, dbus-launch will be able to connect to
the X server to determine when the session ends; most distributors will
want this, but it can be disabled with the standard Autoconf option
If DBUS_ENABLE_X11_AUTOLAUNCH is *also* defined, dbus-launch and libdbus
will be willing to perform autolaunch. Again, most distributors will want
this, but it can be disabled with --disable-x11-autolaunch.
(In reply to comment #5)
> Both these patches look fine to me.
Thanks, applied for 1.4.8, 1.5.0.
I also noticed that the regression tests are broken if X libraries aren't available (pre-existing bug), and that my initial implementation of --disable-x11-autolaunch would also disable dbus-launch's "exit with X server" feature; however, the extra patches I've attached here fix those issues.
Both these new patches seem fine.
Thanks, fixed in git for 1.4.10/1.5.2