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

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