GDBus should support launchd client-side
According to https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/179, GDBus clients cannot connect successfully to a typically-configured dbus-daemon on macOS. I'm forwarding this from dbus and I don't intend to work on it myself, but I can probably help with review, time permitting.
The launchd transport for client-side connections is briefly described in the D-Bus Specification, and seems to be fairly simple:
- Addresses take the form
launchd:env=FOO
. - (Optional) Clients that were directly or indirectly started by launchd can look at their own
FOO
environment variable. (libdbus doesn't actually do this.) - Or, any client can execute a subprocess
launchctl getenv FOO
, read its stdout until EOF, and remove the trailing newline. If the result is empty, fail (decline to connect, try the next transport if any). If non-empty, treat it as the absolute path of a Unix socket: for example iflaunchctl getenv FOO
prints/foo\n
, that should be treated as similar tounix:path=/foo
. - The environment variable is typically
DBUS_LAUNCHD_SESSION_BUS_SOCKET
, solaunchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET
or perhapslaunchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET;autolaunch:
would be a sensible default for the session bus' connectable address on macOS (the same way we useautolaunch:
on other Unixes); or it could be treated as a special case, like the way we handle$XDG_RUNTIME_DIR/bus
.
The server-side protocol is a bit more complicated: it's like a more elaborate version of systemd socket activation (systemd:
), and I suspect we wouldn't want to support it in GDBus.