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

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