Bug#851754: gdm autologin ignores wayland session
David Härdeman
david at hardeman.nu
Thu Apr 27 11:09:19 UTC 2017
Package: gdm3
Version: 3.22.3-1
Followup-For: Bug #851754
Hi,
I've dug through the gdm3 sources and I can confirm this.
The problem is that autologin is racy.
In daemon/gdm-session.c, gdm_session_setup() and
gdm_session_setup_for_user() both do:
send_setup[_for_user](self, service_name);
gdm_session_defaults_changed(self);
send_setup[_for_user]() does asynchronous dbus calls and return
immediately, meaning that gdm_session_defaults_changed() is called
*before* the dbus call is finished and before the user's saved session
has been set.
gdm_session_defaults_changed() calls:
--> update_session_type()
--> gdm_session_is_wayland_session()
--> get_session_filename()
--> get_session_name() /* no session selected */
--> get_default_session_name() /* no saved_session */
--> get_fallback_session_name()
The default session returned by get_fallback_session_name() is "default"
on Debian systems (that's a Debian specific patch, upstream uses "gnome"
as the default) which gets converted to "default.desktop" before
returning to gdm_session_is_wayland_session().
gdm_session_is_wayland_session() then calls load_key_file_for_file(self,
"default.desktop"...) which looks for "default.desktop" in the
directories returned by get_system_session_dirs() in the following
order:
"/etc/X11/sessions/",
DMCONFDIR "/Sessions/",
DATADIR "/gdm/BuiltInSessions/",
DATADIR "/xsessions/",
DATADIR "/wayland-sessions/"
"default.desktop" is found in DATADIR "/gdm/BuiltInSessions/", i.e.
/usr/share/gdm/BuiltInSessions/default.desktop and the full path is
returned to gdm_session_is_wayland_session() which checks the path to
determine if the session is a wayland session:
if (full_path != NULL && strstr (full_path, "/wayland-sessions/") != NULL) {
is_wayland_session = TRUE;
}
This means that gdm_session_is_wayland_session() will always return
false for the default session.
update_session_type() uses the return value (is_wayland_session) as
follows:
if (is_wayland_session) {
set_session_type (self, "wayland");
} else {
set_session_type (self, NULL);
}
gdm_session_start_session() is later called, after the real user session
has been set but update_session_type() is *not* called when that happens.
gdm_session_start_session() does:
gboolean is_x11 = TRUE;
...
#ifdef ENABLE_WAYLAND_SUPPORT
is_x11 = g_strcmp0 (self->priv->session_type, "wayland") != 0;
#endif
if (display_mode == GDM_SESSION_DISPLAY_MODE_LOGIND_MANAGED ||
display_mode == GDM_SESSION_DISPLAY_MODE_NEW_VT) {
run_launcher = TRUE;
}
...
command = get_session_command (self);
...
if (run_launcher) {
if (is_x11) {
program = g_strdup_printf (LIBEXECDIR "/gdm-x-session %s %s\"%s\"",
run_xsession_script? "--run-script " : "",
allow_remote_connections? "--allow-remote-connections " : "",
command);
} else {
program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session \"%s\"",
command);
}
}
Therefore, is_x11 will always be true here.
I couldn't find the right point in time to call update_session_type()
because of all the async dbus calls and callbacks, so I stopped here.
TL;DR; - seems like an upstream bug.
--
David Härdeman
More information about the pkg-gnome-maintainers
mailing list