After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 770395 - gdm-{x,wayland}-session: drop dependency on DBUS_SESSION_BUS_ADDRESS
gdm-{x,wayland}-session: drop dependency on DBUS_SESSION_BUS_ADDRESS
Status: RESOLVED FIXED
Product: gdm
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2016-08-25 14:52 UTC by Ray Strode [halfline]
Modified: 2016-09-01 12:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdm-{x,wayland}-session: drop dependency on DBUS_SESSION_BUS_ADDRESS (20.90 KB, patch)
2016-08-25 14:52 UTC, Ray Strode [halfline]
committed Details | Review

Description Ray Strode [halfline] 2016-08-25 14:52:31 UTC
DBUS_SESSION_BUS_ADDRESS is not the preferred way to find the session
bus these days.  Instead it's expected to be found at $XDG_RUNTIME_DIR/bus

This commit changes the session launcher code, to just try to get a
connection to the bus explicitly, instead relying on
the presence of DBUS_SESSION_BUS_ADDRESS to know whether to start a
fallback bus.
Comment 1 Ray Strode [halfline] 2016-08-25 14:52:36 UTC
Created attachment 334151 [details] [review]
gdm-{x,wayland}-session: drop dependency on DBUS_SESSION_BUS_ADDRESS
Comment 2 Ray Strode [halfline] 2016-08-29 16:27:20 UTC
Attachment 334151 [details] pushed as 957e75e - gdm-{x,wayland}-session: drop dependency on DBUS_SESSION_BUS_ADDRESS
Comment 3 Simon McVittie 2016-09-01 09:18:24 UTC
(In reply to Ray Strode [halfline] from comment #0)
> DBUS_SESSION_BUS_ADDRESS is not the preferred way to find the session
> bus these days.  Instead it's expected to be found at $XDG_RUNTIME_DIR/bus

FYI, this is not true. DBUS_SESSION_BUS_ADDRESS is still the preferred way to find a session bus, and takes precedence over everything else. (If in doubt, the reference implementation libdbus is always right.)

What has changed is that the fallback path used to be:

$DBUS_SESSION_BUS_ADDRESS > autolaunch:

and it is now:

$DBUS_SESSION_BUS_ADDRESS > unix:path=$XDG_RUNTIME_DIR/bus > autolaunch:

> This commit changes the session launcher code, to just try to get a
> connection to the bus explicitly, instead relying on
> the presence of DBUS_SESSION_BUS_ADDRESS to know whether to start a
> fallback bus.

However, this logic is probably fine, assuming nobody has broken GDBus recently.
Comment 4 Ray Strode [halfline] 2016-09-01 10:25:06 UTC
So before the code relied on DBUS_SESSION_BUS_ADDRESS being set. Now it works if just unix:path=$XDG_RUNTIME_DIR/bus is set, so the new code is more technically correct.  I probably could have worded the commit message better.

To me, anyway, unix:path=$XDG_RUNTIME_DIR/bus is preferred, though, even if DBUS_SESSION_BUS_ADDRESS takes precendence, because I don't like environment variables, and my eventual goal is to stop relying on them as much as possible.

See also this comment in the systemd source (src/login/pam_systemd.c):

        /* FIXME: We *really* should move the access() check into the•
         * daemons that spawn dbus-daemon, instead of forcing•
         * DBUS_SESSION_BUS_ADDRESS= here. */•

Anyway, one less getenv() call makes the world a better place.
Comment 5 Simon McVittie 2016-09-01 12:25:24 UTC
(In reply to Ray Strode [halfline] from comment #4)
> So before the code relied on DBUS_SESSION_BUS_ADDRESS being set. Now it
> works if just unix:path=$XDG_RUNTIME_DIR/bus is set, so the new code is more
> technically correct.

Right. I was correcting what I saw as an incorrect statement in the commit message, not the implementation.

(In reply to Ray Strode [halfline] from comment #4)
> To me, anyway, unix:path=$XDG_RUNTIME_DIR/bus is preferred, though, even if
> DBUS_SESSION_BUS_ADDRESS takes precendence, because I don't like environment
> variables, and my eventual goal is to stop relying on them as much as
> possible.

To be clear: I would like unix:path=$XDG_RUNTIME_DIR/bus to be the normal thing to use (and I'm 90% of the way through filing hundreds of Debian bugs to ensure that dbus-launch/dbus-x11 can go away too), but it is important for interoperability that DBUS_SESSION_BUS_ADDRESS must always take precedence over that.

I anticipate that for the next 5 years or so, distributions will have to set DBUS_SESSION_BUS_ADDRESS anyway, to avoid breaking code that second-guesses this; but maybe one day it can become something you only set when you have weird requirements (often involving automated tests), like LD_LIBRARY_PATH or PYTHONPATH.
Comment 6 Ray Strode [halfline] 2016-09-01 12:36:38 UTC
Right. I'm just glad GDM isn't a second guesser now.