Blame SOURCES/0001-daemon-fix-wayland-detection-when-deciding-to-bypass.patch

f83012
From b9f38b65417923624bf97a18daf1c2ede5e8651e Mon Sep 17 00:00:00 2001
f83012
From: Ray Strode <rstrode@redhat.com>
f83012
Date: Sun, 15 Dec 2019 14:51:44 -0500
f83012
Subject: [PATCH] daemon: fix wayland detection when deciding to bypass
f83012
 Xsession
f83012
f83012
At the moment if there's a session file with the same name in
f83012
both /usr/share/xsessions and /usr/share/wayland-sessions, GDM
f83012
will think the wayland is getting used when deciding whether or
f83012
not to bypass the /etc/gdm/Xsession script, even if wayland is
f83012
explicitly being ignored.
f83012
f83012
This commit fixes the check.
f83012
---
f83012
 daemon/gdm-session.c | 28 ++++++++++++++--------------
f83012
 1 file changed, 14 insertions(+), 14 deletions(-)
f83012
f83012
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
f83012
index a8263ba11..ecb2b3cac 100644
f83012
--- a/daemon/gdm-session.c
f83012
+++ b/daemon/gdm-session.c
f83012
@@ -3145,96 +3145,96 @@ gdm_session_get_session_id (GdmSession *self)
f83012
         return conversation->session_id;
f83012
 }
f83012
 
f83012
 const char *
f83012
 gdm_session_get_conversation_session_id (GdmSession *self,
f83012
                                          const char *service_name)
f83012
 {
f83012
         GdmSessionConversation *conversation;
f83012
 
f83012
         g_return_val_if_fail (GDM_IS_SESSION (self), NULL);
f83012
 
f83012
         conversation = find_conversation_by_name (self, service_name);
f83012
 
f83012
         if (conversation == NULL) {
f83012
                 return NULL;
f83012
         }
f83012
 
f83012
         return conversation->session_id;
f83012
 }
f83012
 
f83012
 static char *
f83012
 get_session_filename (GdmSession *self)
f83012
 {
f83012
         return g_strdup_printf ("%s.desktop", get_session_name (self));
f83012
 }
f83012
 
f83012
 #ifdef ENABLE_WAYLAND_SUPPORT
f83012
 static gboolean
f83012
 gdm_session_is_wayland_session (GdmSession *self)
f83012
 {
f83012
-        GKeyFile   *key_file;
f83012
+        g_autoptr (GKeyFile) key_file = NULL;
f83012
         gboolean    is_wayland_session = FALSE;
f83012
-        char       *filename;
f83012
-        char       *full_path = NULL;
f83012
+        g_autofree char       *filename = NULL;
f83012
+        g_autofree char       *full_path = NULL;
f83012
 
f83012
         g_return_val_if_fail (self != NULL, FALSE);
f83012
         g_return_val_if_fail (GDM_IS_SESSION (self), FALSE);
f83012
 
f83012
         filename = get_session_filename (self);
f83012
 
f83012
-        key_file = load_key_file_for_file (self, filename, "wayland", &full_path);
f83012
+        if (!self->priv->ignore_wayland) {
f83012
+                key_file = load_key_file_for_file (self, filename, "wayland", &full_path);
f83012
 
f83012
-        if (key_file == NULL) {
f83012
-                goto out;
f83012
-        }
f83012
+                if (key_file == NULL) {
f83012
+                        goto out;
f83012
+                }
f83012
 
f83012
-        if (full_path != NULL && strstr (full_path, "/wayland-sessions/") != NULL) {
f83012
-                is_wayland_session = TRUE;
f83012
+                if (full_path != NULL && strstr (full_path, "/wayland-sessions/") != NULL) {
f83012
+                        is_wayland_session = TRUE;
f83012
+                }
f83012
         }
f83012
-        g_debug ("GdmSession: checking if file '%s' is wayland session: %s", filename, is_wayland_session? "yes" : "no");
f83012
 
f83012
 out:
f83012
-        g_clear_pointer (&key_file, (GDestroyNotify) g_key_file_free);
f83012
-        g_free (filename);
f83012
+        g_debug ("GdmSession: checking if file '%s' is wayland session: %s", filename, is_wayland_session? "yes" : "no");
f83012
+
f83012
         return is_wayland_session;
f83012
 }
f83012
 #endif
f83012
 
f83012
 static void
f83012
 update_session_type (GdmSession *self)
f83012
 {
f83012
 #ifdef ENABLE_WAYLAND_SUPPORT
f83012
         gboolean is_wayland_session = FALSE;
f83012
 
f83012
-        if (!self->priv->ignore_wayland)
f83012
-                is_wayland_session = gdm_session_is_wayland_session (self);
f83012
+        is_wayland_session = gdm_session_is_wayland_session (self);
f83012
 
f83012
         if (is_wayland_session) {
f83012
                 set_session_type (self, "wayland");
f83012
         } else {
f83012
                 set_session_type (self, NULL);
f83012
         }
f83012
 #endif
f83012
 }
f83012
 
f83012
 gboolean
f83012
 gdm_session_bypasses_xsession (GdmSession *self)
f83012
 {
f83012
         GError     *error;
f83012
         GKeyFile   *key_file;
f83012
         gboolean    res;
f83012
         gboolean    bypasses_xsession = FALSE;
f83012
         char       *filename = NULL;
f83012
 
f83012
         g_return_val_if_fail (self != NULL, FALSE);
f83012
         g_return_val_if_fail (GDM_IS_SESSION (self), FALSE);
f83012
 
f83012
 #ifdef ENABLE_WAYLAND_SUPPORT
f83012
         if (gdm_session_is_wayland_session (self)) {
f83012
                 bypasses_xsession = TRUE;
f83012
                 goto out;
f83012
         }
f83012
 #endif
f83012
 
f83012
         filename = get_session_filename (self);
f83012
 
f83012
-- 
f83012
2.18.1
f83012