Blame SOURCES/0016-local-display-factory-don-t-start-two-greeters-at-st.patch

a1b388
From e5bf6d78ff8f54bbb74e572f05ccbf1c0df24017 Mon Sep 17 00:00:00 2001
a1b388
From: Ray Strode <rstrode@redhat.com>
a1b388
Date: Tue, 7 Aug 2018 13:55:06 -0400
a1b388
Subject: [PATCH 16/51] local-display-factory: don't start two greeters at
a1b388
 startup
a1b388
a1b388
commit c0188a7030 added some complex code for starting
a1b388
the login screen when the user switches to the initial
a1b388
VT if nothing is running on that VT.
a1b388
a1b388
The problem is, we get a VT change event on that VT as
a1b388
part of the start up process.
a1b388
a1b388
This leads to an additional greeter getting started.
a1b388
a1b388
This commit adds a check to side step the new code during
a1b388
startup.
a1b388
a1b388
Closes: https://gitlab.gnome.org/GNOME/gdm/issues/409
a1b388
---
a1b388
 daemon/gdm-local-display-factory.c | 6 ++++++
a1b388
 1 file changed, 6 insertions(+)
a1b388
a1b388
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
a1b388
index 2a2259f2a..9f377ba9a 100644
a1b388
--- a/daemon/gdm-local-display-factory.c
a1b388
+++ b/daemon/gdm-local-display-factory.c
a1b388
@@ -600,60 +600,66 @@ on_vt_changed (GIOChannel    *source,
a1b388
                 g_autoptr (GError) error = NULL;
a1b388
                 status = g_io_channel_read_line (source, &tty_of_active_vt, NULL, NULL, &error);
a1b388
 
a1b388
                 if (error != NULL) {
a1b388
                         g_warning ("could not read active VT from kernel: %s", error->message);
a1b388
                 }
a1b388
                 switch (status) {
a1b388
                         case G_IO_STATUS_ERROR:
a1b388
                             return G_SOURCE_REMOVE;
a1b388
                         case G_IO_STATUS_EOF:
a1b388
                             return G_SOURCE_REMOVE;
a1b388
                         case G_IO_STATUS_AGAIN:
a1b388
                             return G_SOURCE_CONTINUE;
a1b388
                         case G_IO_STATUS_NORMAL:
a1b388
                             break;
a1b388
                 }
a1b388
         }
a1b388
 
a1b388
         if ((condition & G_IO_ERR) || (condition & G_IO_HUP)) {
a1b388
                 g_debug ("GdmLocalDisplayFactory: kernel hung up active vt watch");
a1b388
                 return G_SOURCE_REMOVE;
a1b388
         }
a1b388
 
a1b388
         if (tty_of_active_vt == NULL) {
a1b388
                 g_debug ("GdmLocalDisplayFactory: unable to read active VT from kernel");
a1b388
                 return G_SOURCE_CONTINUE;
a1b388
         }
a1b388
 
a1b388
         g_strchomp (tty_of_active_vt);
a1b388
 
a1b388
+        /* don't do anything if we're on the same VT we were before */
a1b388
+        if (g_strcmp0 (tty_of_active_vt, factory->priv->tty_of_active_vt) == 0) {
a1b388
+                g_debug ("GdmLocalDisplayFactory: VT changed to the same VT, ignoring");
a1b388
+                return G_SOURCE_CONTINUE;
a1b388
+        }
a1b388
+
a1b388
         tty_of_previous_vt = g_steal_pointer (&factory->priv->tty_of_active_vt);
a1b388
         factory->priv->tty_of_active_vt = g_steal_pointer (&tty_of_active_vt);
a1b388
 
a1b388
         /* don't do anything at start up */
a1b388
         if (tty_of_previous_vt == NULL) {
a1b388
                 g_debug ("GdmLocalDisplayFactory: VT is %s at startup",
a1b388
                          factory->priv->tty_of_active_vt);
a1b388
                 return G_SOURCE_CONTINUE;
a1b388
         }
a1b388
 
a1b388
         g_debug ("GdmLocalDisplayFactory: VT changed from %s to %s",
a1b388
                  tty_of_previous_vt, factory->priv->tty_of_active_vt);
a1b388
 
a1b388
         /* if the old VT was running a wayland login screen kill it
a1b388
          */
a1b388
         if (gdm_get_login_window_session_id ("seat0", &login_session_id)) {
a1b388
                 unsigned int vt;
a1b388
 
a1b388
                 ret = sd_session_get_vt (login_session_id, &vt;;
a1b388
                 if (ret == 0 && vt != 0) {
a1b388
                         g_autofree char *tty_of_login_window_vt = NULL;
a1b388
 
a1b388
                         tty_of_login_window_vt = g_strdup_printf ("tty%u", vt);
a1b388
 
a1b388
                         g_debug ("GdmLocalDisplayFactory: tty of login window is %s", tty_of_login_window_vt);
a1b388
                         if (g_strcmp0 (tty_of_login_window_vt, tty_of_previous_vt) == 0) {
a1b388
                                 GdmDisplayStore *store;
a1b388
                                 GdmDisplay *display;
a1b388
 
a1b388
                                 g_debug ("GdmLocalDisplayFactory: VT switched from login window");
a1b388
-- 
a1b388
2.27.0
a1b388