GNOME Bugzilla – Bug 787304
"Ubuntu" and "Ubuntu on Xorg" randomly start the same session (maybe Wayland maybe Xorg)
Last modified: 2017-09-12 15:12:27 UTC
Original report in launchpad: https://bugs.launchpad.net/ubuntu/+source/gnome-session/+bug/1705157 Similar report: https://bugzilla.gnome.org/show_bug.cgi?id=777669 From LP: Test case: Do a fresh install of current image (july 19 here Boot up, check selected session at the greeter - it will say "ubuntu" Log in, ck. env., it will actually be ubuntu-wayland Ex. $ env | grep -i wayland DESKTOP_SESSION=ubuntu-wayland WAYLAND_DISPLAY=wayland-0 XDG_SESSION_TYPE=wayland XDG_SESSION_DESKTOP=ubuntu-wayland GDMSESSION=ubuntu-wayland Test 2: From above log out, switch session in greeter to wayland on ubuntu,, switch back to ubuntu, login. Now you'll be in an ubuntu session Test 3: log out from above ubuntu session, log into ubuntu-wayland session, reboot. At greeter notice it says "ubuntu" selected. Login, ck. session. You'll actually be in an ubuntu-wayland session = Workaround = In gdm click on the cog: - Select 'Ubuntu', 'Ubuntu on Xorg', 'Ubuntu' will start a wayland session - Select 'Ubuntu on Xorg', 'Ubuntu', 'Ubuntu on Xorg' will start an xorg session.
Why was the issue copied from Ubuntu's bugtracker to GNOME Bugzilla? Can you please explain why you think that this is an upstream code issue?
because that package is not patched in an ubuntu specific way, the ubuntu/ubuntu on x11 sessions are additional sessions similar to gnome/gnome on X from upstream
I noticed this bug yesterday. After install "gnome-sesion" and select "Gnome" as my session, GDM started Ubuntu session.
Created attachment 359621 [details] [review] gdm-session: Calculate fallback session name without ".desktop" When the user has not ever selected a session from the selector, we will log them into the `fallback' session, which is calculated by looking at all installed sessions and picking the first one in the list. There is a bug that the visually selected session presented in the greeter can be different from the fallback session calculated inside GDM. This happens because the two sort sessions differently. Inside GDM we calculate the fallback session by comparing the full basename of the file: >>> GLib.strcmp0("gnome-xorg.desktop", "gnome.desktop") -1 Whereas gnome-shell calls gdm_get_session_ids(), which returns IDs without the ".desktop" extension. Those are then sorted: >>> GLib.strcmp0("gnome-xorg", "gnome") 45 which gives a different ordering. Fix this bug by calculating the fallback session in the same way, by removing ".desktop" from the filename. https://bugs.launchpad.net/ubuntu/+source/gnome-session/+bug/1705157
Created attachment 359622 [details] [review] gdm-session: Calculate fallback session name without ".desktop" When the user has not ever selected a session from the selector, we will log them into the `fallback' session, which is calculated by looking at all installed sessions and picking the first one in the list. There is a bug that the visually selected session presented in the greeter can be different from the fallback session calculated inside GDM. This happens because the two sort sessions differently. Inside GDM we calculate the fallback session by comparing the full basename of the file: >>> GLib.strcmp0("gnome-xorg.desktop", "gnome.desktop") -1 Whereas gnome-shell calls gdm_get_session_ids(), which returns IDs without the ".desktop" extension. Those are then sorted: >>> GLib.strcmp0("gnome-xorg", "gnome") 45 which gives a different ordering. Fix this bug by calculating the fallback session in the same way, by removing ".desktop" from the filename. https://bugs.launchpad.net/ubuntu/+source/gnome-session/+bug/1705157
Review of attachment 359622 [details] [review]: Some feedback to myself, which I could fix when pushing. :) ::: daemon/gdm-session.c @@ +576,3 @@ + name = g_strndup (base_name, + strlen (base_name) - + strlen (".desktop")); wrap onto a single line? @@ +577,3 @@ + strlen (base_name) - + strlen (".desktop")); + g_sequence_insert_sorted (sessions, g_strdup (name), (GCompareDataFunc) g_strcmp0, NULL); I don't need to g_strdup here.
Review of attachment 359622 [details] [review]: nice find! I'm going to go ahead and push it after making the leak fix change, since I need to do a 3.24 release today (for a CVE) and I want to get this into the release too.
Attachment 359622 [details] pushed as 9606bf4 - gdm-session: Calculate fallback session name without ".desktop"