Source: golang-dbus
Version: 3-1
Severity: normal
Tags: upstream
User: [email protected]
Usertags: dbus-launch dbus-launch-wrong dbus-launch-unless-dsba

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.

While searching for unnecessary instances of dbus-launch, I happened to
look at golang-dbus. This implements X11 autolaunch (the "autolaunch:"
transport) *almost* correctly, but will not interoperate correctly with
other implementations of the autolaunch: transport, because each
golang-dbus user will start their own session dbus-daemon.

It currently calls:

    cmd := exec.Command("dbus-launch")

The correct behaviour would be more like what libdbus and GDBus do:

* If the DISPLAY environment variable is unset, fail.

* Get the *machine ID* by reading /var/lib/dbus/machine-id if it exists.
  If not, read /etc/machine-id. If that doesn't exist either, fail.
  Chop off any trailing newline. You should now have 16 hex digits.

* Execute dbus-launch with the --autolaunch option, followed by the
  machine ID. The --close-stderr option is also recommended.

* You can use either --binary-syntax or no syntax option, whichever
  is easier for you to parse.

In addition, it would be good if golang-dbus implemented the same
fallback as libdbus, GDBus and sd-bus when DBUS_SESSION_BUS_ADDRESS
is unset, before it attempts X11 autolaunch:

* If the XDG_RUNTIME_DIR environment variable is unset, fail.

* Look for a file named "bus" in the directory named by that
  variable, and stat it. If it does not exist, fail.

* If it is not a socket, fail.

* If it is not owned by getuid(), fail.

* Use that socket.

(This would not be strictly necessary if golang-dbus implemented
X11 autolaunching correctly, because dbus-launch >= 1.10 will
go through the same process when run with the --autolaunch option.)

Thanks,
    S

Reply via email to