Blob Blame History Raw
From f1b7d85b46dfc253176d6a043dcce26da3a26dfb Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 13 Jul 2020 09:23:06 -0400
Subject: [PATCH 48/51] manager: don't kill initial-setup right away with Xorg
 either

The login screen for both Xorg and wayland sessions is now silently
killed in the background post login.

We still kill initial-setup for Xorg sessions up front, though.

This commit fixes that.
---
 daemon/gdm-manager.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index cf982870c..b147d73db 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -1757,123 +1757,107 @@ chown_initial_setup_home_dir (void)
 
         uid = (uid_t) atoi (gis_uid_contents);
         pwe = getpwuid (uid);
         if (uid == 0 || pwe == NULL) {
                 g_warning ("UID '%s' in %s is not valid", gis_uid_contents, gis_uid_path);
                 goto out;
         }
 
         error = NULL;
         dir = g_file_new_for_path (gis_dir_path);
         if (!chown_recursively (dir, pwe->pw_uid, pwe->pw_gid, &error)) {
                 g_warning ("Failed to change ownership for %s: %s", gis_dir_path, error->message);
                 g_error_free (error);
         }
         g_object_unref (dir);
 out:
         g_free (gis_uid_contents);
         g_free (gis_uid_path);
         g_free (gis_dir_path);
 }
 
 static gboolean
 on_start_user_session (StartUserSessionOperation *operation)
 {
         GdmManager *self = operation->manager;
         gboolean migrated;
         gboolean fail_if_already_switched = TRUE;
         gboolean doing_initial_setup = FALSE;
         GdmDisplay *display;
         const char *session_id;
-#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
-        g_autofree char *display_session_type = NULL;
-#endif
 
         g_debug ("GdmManager: start or jump to session");
 
         /* If there's already a session running, jump to it.
          * If the only session running is the one we just opened,
          * start a session on it.
          */
         migrated = switch_to_compatible_user_session (operation->manager, operation->session, fail_if_already_switched);
 
         g_debug ("GdmManager: migrated: %d", migrated);
         if (migrated) {
                 /* We don't stop the manager here because
                    when Xorg exits it switches to the VT it was
                    started from.  That interferes with fast
                    user switching. */
                 gdm_session_reset (operation->session);
                 destroy_start_user_session_operation (operation);
                 goto out;
         }
 
         display = get_display_for_user_session (operation->session);
 
         g_object_get (G_OBJECT (display),
                       "doing-initial-setup", &doing_initial_setup,
-#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
-                      "session-type", &display_session_type,
-#endif
                       NULL);
 
         session_id = gdm_session_get_conversation_session_id (operation->session,
                                                               operation->service_name);
 
         if (gdm_session_get_display_mode (operation->session) == GDM_SESSION_DISPLAY_MODE_REUSE_VT) {
                 /* In this case, the greeter's display is morphing into
                  * the user session display. Kill the greeter on this session
                  * and let the user session follow the same display. */
                 gdm_display_stop_greeter_session (display);
                 g_object_set (G_OBJECT (display),
                                 "session-class", "user",
                                 "session-id", session_id,
                                 NULL);
         } else {
                 uid_t allowed_uid;
 
                 g_object_ref (display);
                 if (doing_initial_setup) {
                         g_autoptr(GError) error = NULL;
 
-#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
-                        if (g_strcmp0 (display_session_type, "wayland") == 0) {
-                                g_debug ("GdmManager: closing down initial setup display in background");
-                                g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_WAITING_TO_FINISH, NULL);
-                        }
-#endif
-                        if (gdm_display_get_status (display) == GDM_DISPLAY_MANAGED) {
-                                g_debug ("GdmManager: closing down initial setup display");
-                                gdm_display_stop_greeter_session (display);
-                                gdm_display_unmanage (display);
-                                gdm_display_finish (display);
-                        }
+                        g_debug ("GdmManager: closing down initial setup display in background");
+                        g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_WAITING_TO_FINISH, NULL);
 
                         chown_initial_setup_home_dir ();
 
                         if (!g_file_set_contents (ALREADY_RAN_INITIAL_SETUP_ON_THIS_BOOT,
                                                   "1",
                                                   1,
                                                   &error)) {
                                 g_warning ("GdmDisplay: Could not write initial-setup-done marker to %s: %s",
                                            ALREADY_RAN_INITIAL_SETUP_ON_THIS_BOOT,
                                            error->message);
                                 g_clear_error (&error);
                         }
                 } else {
                         g_debug ("GdmManager: session has its display server, reusing our server for another login screen");
                 }
 
                 /* The user session is going to follow the session worker
                  * into the new display. Untie it from this display and
                  * create a new session for a future user login. */
                 allowed_uid = gdm_session_get_allowed_user (operation->session);
                 g_object_set_data (G_OBJECT (display), "gdm-user-session", NULL);
                 g_object_set_data (G_OBJECT (operation->session), "gdm-display", NULL);
                 create_user_session_for_display (operation->manager, display, allowed_uid);
 
                 /* Give the user session a new display object for bookkeeping purposes */
                 create_display_for_user_session (operation->manager,
                                                  operation->session,
                                                  session_id);
 
                 if ((g_strcmp0 (operation->service_name, "gdm-autologin") == 0) &&
-- 
2.27.0