Avoid moonshot-dbus-launch

Bug #1618562 reported by Sam Hartman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Moonshot ID Selector
Confirmed
Wishlist
Unassigned
moonshot-ui (Debian)
Confirmed
Unknown

Bug Description

In debian bug #836116, I received the following comments about our moonshot-dbus-launch script.
As described in <https://lists.debian.org/debian-devel/2016/08/msg00554.html>
I'm trying to reduce how much dbus-launch is used in Debian.
moonshot-ui currently runs dbus-launch via moonshot-dbus-launch
if DBUS_SESSION_BUS_ADDRESS is unset.

One issue with this approach is that it second-guesses how the D-Bus
client implementation itself will find the session bus. In recent libdbus
and GDBus, the fallback behaviour if DBUS_SESSION_BUS_ADDRESS is unset
is to look for $XDG_RUNTIME_DIR/bus: if the environment variable is
set, that directory contains ./bus, and ./bus is a socket owned by
the current uid, then libdbus and GDBus will automatically use it. In
particular, the dbus-user-session Debian package sets up this situation.
moonshot-dbus-launch should not run dbus-launch without first looking
for that socket.

Another issue with the approach moonshot-ui has taken is that it relies
on dbus-launch, which is X11-specific legacy code that does several
things, none of them particularly well.
This Flatpak commit illustrates how eval `dbus-launch` can be replaced
by invoking dbus-daemon directly, avoiding the X11-specific dbus-launch:
<https://github.com/flatpak/flatpak/commit/6cc8062cfb3f9410d54a27e7ccca77c103e441e8>.
It is possible to send both the address and the pid to stdout
("--print-address=1 --print-pid=1") if that would be easier to deal
with; their order is undocumented but predictable, and I don't intend
to break it in future D-Bus releases.

Alternatively, and perhaps most simply, moonshot-ui could stop trying to
compensate for a missing session bus address at all. On systems with
$XDG_RUNTIME_DIR/bus, it would "just work" anyway; or when run under X11
(even with no dbus-daemon running), X11 autolaunching would create a
dbus-daemon anyway; or if moonshot-ui is being run in a non-GUI
environment (can that even make sense?), its documentation could mention
that this requires using

    dbus-run-session -- COMMAND [ARGS...]

which has been available since dbus 1.8, and automatically cleans up
the dbus-daemon after COMMAND terminates (successfully or not).

This is really an upstream bug. If you forward it upstream, please
quote the full text of this bug report and let upstream make their
own decisions.

Thanks,
    S

Revision history for this message
Sam Hartman (hartmans) wrote :

As I told Simon, I'm not sure that we actually fail to respect XDF_RUNTIME_DIR/bus because of the way the dbus_connect function works in libmoonshot/libmoonshot-dbus.c. However, I do think that launching the daemon directly might make a lot more sense than using the shell script we have.

Changed in moonshot-ui (Debian):
status: Unknown → Confirmed
Changed in moonshot-ui:
importance: Undecided → Wishlist
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.