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 787304 - "Ubuntu" and "Ubuntu on Xorg" randomly start the same session (maybe Wayland maybe Xorg)
"Ubuntu" and "Ubuntu on Xorg" randomly start the same session (maybe Wayland ...
Status: RESOLVED FIXED
Product: gdm
Classification: Core
Component: general
3.25.x
Other Linux
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2017-09-05 10:49 UTC by JB Lallement
Modified: 2017-09-12 15:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdm-session: Calculate fallback session name without ".desktop" (2.99 KB, patch)
2017-09-12 12:46 UTC, Iain Lane
none Details | Review
gdm-session: Calculate fallback session name without ".desktop" (3.06 KB, patch)
2017-09-12 13:01 UTC, Iain Lane
committed Details | Review

Description JB Lallement 2017-09-05 10:49:30 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.
Comment 1 André Klapper 2017-09-05 12:54:57 UTC
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?
Comment 2 Sebastien Bacher 2017-09-05 14:19:37 UTC
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
Comment 3 Strangiato 2017-09-05 15:59:29 UTC
I noticed this bug yesterday.
After install "gnome-sesion" and select "Gnome" as my session, GDM started Ubuntu session.
Comment 4 Iain Lane 2017-09-12 12:46:33 UTC
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
Comment 5 Iain Lane 2017-09-12 13:01:33 UTC
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
Comment 6 Iain Lane 2017-09-12 13:30:08 UTC
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.
Comment 7 Ray Strode [halfline] 2017-09-12 14:59:36 UTC
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.
Comment 8 Ray Strode [halfline] 2017-09-12 15:12:25 UTC
Attachment 359622 [details] pushed as 9606bf4 - gdm-session: Calculate fallback session name without ".desktop"