Blame SOURCES/0048-manager-don-t-kill-initial-setup-right-away-with-Xor.patch

400dab
From f1b7d85b46dfc253176d6a043dcce26da3a26dfb Mon Sep 17 00:00:00 2001
400dab
From: Ray Strode <rstrode@redhat.com>
400dab
Date: Mon, 13 Jul 2020 09:23:06 -0400
400dab
Subject: [PATCH 48/51] manager: don't kill initial-setup right away with Xorg
400dab
 either
400dab
400dab
The login screen for both Xorg and wayland sessions is now silently
400dab
killed in the background post login.
400dab
400dab
We still kill initial-setup for Xorg sessions up front, though.
400dab
400dab
This commit fixes that.
400dab
---
400dab
 daemon/gdm-manager.c | 20 ++------------------
400dab
 1 file changed, 2 insertions(+), 18 deletions(-)
400dab
400dab
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
400dab
index cf982870c..b147d73db 100644
400dab
--- a/daemon/gdm-manager.c
400dab
+++ b/daemon/gdm-manager.c
400dab
@@ -1757,123 +1757,107 @@ chown_initial_setup_home_dir (void)
400dab
 
400dab
         uid = (uid_t) atoi (gis_uid_contents);
400dab
         pwe = getpwuid (uid);
400dab
         if (uid == 0 || pwe == NULL) {
400dab
                 g_warning ("UID '%s' in %s is not valid", gis_uid_contents, gis_uid_path);
400dab
                 goto out;
400dab
         }
400dab
 
400dab
         error = NULL;
400dab
         dir = g_file_new_for_path (gis_dir_path);
400dab
         if (!chown_recursively (dir, pwe->pw_uid, pwe->pw_gid, &error)) {
400dab
                 g_warning ("Failed to change ownership for %s: %s", gis_dir_path, error->message);
400dab
                 g_error_free (error);
400dab
         }
400dab
         g_object_unref (dir);
400dab
 out:
400dab
         g_free (gis_uid_contents);
400dab
         g_free (gis_uid_path);
400dab
         g_free (gis_dir_path);
400dab
 }
400dab
 
400dab
 static gboolean
400dab
 on_start_user_session (StartUserSessionOperation *operation)
400dab
 {
400dab
         GdmManager *self = operation->manager;
400dab
         gboolean migrated;
400dab
         gboolean fail_if_already_switched = TRUE;
400dab
         gboolean doing_initial_setup = FALSE;
400dab
         GdmDisplay *display;
400dab
         const char *session_id;
400dab
-#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
400dab
-        g_autofree char *display_session_type = NULL;
400dab
-#endif
400dab
 
400dab
         g_debug ("GdmManager: start or jump to session");
400dab
 
400dab
         /* If there's already a session running, jump to it.
400dab
          * If the only session running is the one we just opened,
400dab
          * start a session on it.
400dab
          */
400dab
         migrated = switch_to_compatible_user_session (operation->manager, operation->session, fail_if_already_switched);
400dab
 
400dab
         g_debug ("GdmManager: migrated: %d", migrated);
400dab
         if (migrated) {
400dab
                 /* We don't stop the manager here because
400dab
                    when Xorg exits it switches to the VT it was
400dab
                    started from.  That interferes with fast
400dab
                    user switching. */
400dab
                 gdm_session_reset (operation->session);
400dab
                 destroy_start_user_session_operation (operation);
400dab
                 goto out;
400dab
         }
400dab
 
400dab
         display = get_display_for_user_session (operation->session);
400dab
 
400dab
         g_object_get (G_OBJECT (display),
400dab
                       "doing-initial-setup", &doing_initial_setup,
400dab
-#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
400dab
-                      "session-type", &display_session_type,
400dab
-#endif
400dab
                       NULL);
400dab
 
400dab
         session_id = gdm_session_get_conversation_session_id (operation->session,
400dab
                                                               operation->service_name);
400dab
 
400dab
         if (gdm_session_get_display_mode (operation->session) == GDM_SESSION_DISPLAY_MODE_REUSE_VT) {
400dab
                 /* In this case, the greeter's display is morphing into
400dab
                  * the user session display. Kill the greeter on this session
400dab
                  * and let the user session follow the same display. */
400dab
                 gdm_display_stop_greeter_session (display);
400dab
                 g_object_set (G_OBJECT (display),
400dab
                                 "session-class", "user",
400dab
                                 "session-id", session_id,
400dab
                                 NULL);
400dab
         } else {
400dab
                 uid_t allowed_uid;
400dab
 
400dab
                 g_object_ref (display);
400dab
                 if (doing_initial_setup) {
400dab
                         g_autoptr(GError) error = NULL;
400dab
 
400dab
-#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
400dab
-                        if (g_strcmp0 (display_session_type, "wayland") == 0) {
400dab
-                                g_debug ("GdmManager: closing down initial setup display in background");
400dab
-                                g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_WAITING_TO_FINISH, NULL);
400dab
-                        }
400dab
-#endif
400dab
-                        if (gdm_display_get_status (display) == GDM_DISPLAY_MANAGED) {
400dab
-                                g_debug ("GdmManager: closing down initial setup display");
400dab
-                                gdm_display_stop_greeter_session (display);
400dab
-                                gdm_display_unmanage (display);
400dab
-                                gdm_display_finish (display);
400dab
-                        }
400dab
+                        g_debug ("GdmManager: closing down initial setup display in background");
400dab
+                        g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_WAITING_TO_FINISH, NULL);
400dab
 
400dab
                         chown_initial_setup_home_dir ();
400dab
 
400dab
                         if (!g_file_set_contents (ALREADY_RAN_INITIAL_SETUP_ON_THIS_BOOT,
400dab
                                                   "1",
400dab
                                                   1,
400dab
                                                   &error)) {
400dab
                                 g_warning ("GdmDisplay: Could not write initial-setup-done marker to %s: %s",
400dab
                                            ALREADY_RAN_INITIAL_SETUP_ON_THIS_BOOT,
400dab
                                            error->message);
400dab
                                 g_clear_error (&error);
400dab
                         }
400dab
                 } else {
400dab
                         g_debug ("GdmManager: session has its display server, reusing our server for another login screen");
400dab
                 }
400dab
 
400dab
                 /* The user session is going to follow the session worker
400dab
                  * into the new display. Untie it from this display and
400dab
                  * create a new session for a future user login. */
400dab
                 allowed_uid = gdm_session_get_allowed_user (operation->session);
400dab
                 g_object_set_data (G_OBJECT (display), "gdm-user-session", NULL);
400dab
                 g_object_set_data (G_OBJECT (operation->session), "gdm-display", NULL);
400dab
                 create_user_session_for_display (operation->manager, display, allowed_uid);
400dab
 
400dab
                 /* Give the user session a new display object for bookkeeping purposes */
400dab
                 create_display_for_user_session (operation->manager,
400dab
                                                  operation->session,
400dab
                                                  session_id);
400dab
 
400dab
                 if ((g_strcmp0 (operation->service_name, "gdm-autologin") == 0) &&
400dab
-- 
400dab
2.27.0
400dab