Blame SOURCES/0002-gdm-x-session-run-session-bus-on-non-seat0-seats.patch

ffa191
From 81efb06506456a260d63b77e3dda1216041b5bb3 Mon Sep 17 00:00:00 2001
f83012
From: Ray Strode <rstrode@redhat.com>
f83012
Date: Wed, 5 Feb 2020 15:20:48 -0500
ffa191
Subject: [PATCH 2/3] gdm-x-session: run session bus on non-seat0 seats
f83012
f83012
GNOME doesn't deal very well with multiple sessions
f83012
running on a multiple seats at the moment.
f83012
f83012
Until that's fixed, ensure sessions run on auxillary
f83012
seats get their own session bus.
f83012
---
ffa191
 daemon/gdm-session.c | 11 ++++++++++-
ffa191
 1 file changed, 10 insertions(+), 1 deletion(-)
f83012
f83012
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
ffa191
index 5c5903a49..c891fb577 100644
f83012
--- a/daemon/gdm-session.c
f83012
+++ b/daemon/gdm-session.c
ffa191
@@ -2811,119 +2811,128 @@ on_start_program_cb (GdmDBusWorker *worker,
f83012
         if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED) ||
f83012
             g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
f83012
                 return;
f83012
 
f83012
         self = conversation->session;
f83012
         service_name = conversation->service_name;
f83012
 
f83012
         if (worked) {
ffa191
                 self->session_pid = pid;
ffa191
                 self->session_conversation = conversation;
f83012
 
f83012
                 g_debug ("GdmSession: Emitting 'session-started' signal with pid '%d'", pid);
f83012
                 g_signal_emit (self, signals[SESSION_STARTED], 0, service_name, pid);
f83012
         } else {
f83012
                 gdm_session_stop_conversation (self, service_name);
f83012
 
f83012
                 g_debug ("GdmSession: Emitting 'session-start-failed' signal");
f83012
                 g_signal_emit (self, signals[SESSION_START_FAILED], 0, service_name, error->message);
f83012
         }
f83012
 }
f83012
 
f83012
 void
f83012
 gdm_session_start_session (GdmSession *self,
f83012
                            const char *service_name)
f83012
 {
f83012
         GdmSessionConversation *conversation;
f83012
         GdmSessionDisplayMode   display_mode;
f83012
         gboolean                is_x11 = TRUE;
f83012
         gboolean                run_launcher = FALSE;
f83012
         gboolean                allow_remote_connections = FALSE;
f83012
+        gboolean                run_separate_bus = FALSE;
f83012
         char                   *command;
f83012
         char                   *program;
ffa191
         gboolean               register_session;
f83012
 
f83012
         g_return_if_fail (GDM_IS_SESSION (self));
ffa191
         g_return_if_fail (self->session_conversation == NULL);
f83012
 
f83012
         conversation = find_conversation_by_name (self, service_name);
f83012
 
f83012
         if (conversation == NULL) {
f83012
                 g_warning ("GdmSession: Tried to start session of "
f83012
                            "nonexistent conversation %s", service_name);
f83012
                 return;
f83012
         }
f83012
 
f83012
         stop_all_other_conversations (self, conversation, FALSE);
f83012
 
f83012
         display_mode = gdm_session_get_display_mode (self);
f83012
 
f83012
 #ifdef ENABLE_WAYLAND_SUPPORT
ffa191
         is_x11 = g_strcmp0 (self->session_type, "wayland") != 0;
f83012
 #endif
f83012
 
f83012
         if (display_mode == GDM_SESSION_DISPLAY_MODE_LOGIND_MANAGED ||
f83012
             display_mode == GDM_SESSION_DISPLAY_MODE_NEW_VT) {
f83012
                 run_launcher = TRUE;
f83012
         }
f83012
 
ffa191
         register_session = !gdm_session_session_registers (self);
ffa191
 
ffa191
+        if (g_strcmp0 (priv->display_seat_id, "seat0") != 0 && !run_launcher) {
f83012
+                run_separate_bus = TRUE;
f83012
+        }
f83012
+
ffa191
         if (self->selected_program == NULL) {
f83012
                 gboolean run_xsession_script;
f83012
 
f83012
                 command = get_session_command (self);
f83012
 
f83012
                 run_xsession_script = !gdm_session_bypasses_xsession (self);
f83012
 
ffa191
                 if (self->display_is_local) {
f83012
                         gboolean disallow_tcp = TRUE;
f83012
                         gdm_settings_direct_get_boolean (GDM_KEY_DISALLOW_TCP, &disallow_tcp);
f83012
                         allow_remote_connections = !disallow_tcp;
f83012
                 } else {
f83012
                         allow_remote_connections = TRUE;
f83012
                 }
f83012
 
f83012
                 if (run_launcher) {
f83012
                         if (is_x11) {
ffa191
                                 program = g_strdup_printf (LIBEXECDIR "/gdm-x-session %s%s %s\"%s\"",
ffa191
                                                            register_session ? "--register-session " : "",
f83012
                                                            run_xsession_script? "--run-script " : "",
f83012
                                                            allow_remote_connections? "--allow-remote-connections " : "",
f83012
                                                            command);
f83012
                         } else {
ffa191
                                 program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s\"",
ffa191
                                                            register_session ? "--register-session " : "",
f83012
                                                            command);
f83012
                         }
f83012
                 } else if (run_xsession_script) {
f83012
-                        program = g_strdup_printf (GDMCONFDIR "/Xsession \"%s\"", command);
ffa191
+                        if (run_separate_bus) {
ffa191
+                                program = g_strdup_printf ("dbus-run-session -- " GDMCONFDIR "/Xsession \"%s\"", command);
ffa191
+                        } else {
ffa191
+                                program = g_strdup_printf (GDMCONFDIR "/Xsession \"%s\"", command);
ffa191
+                        }
f83012
                 } else {
f83012
                         program = g_strdup (command);
f83012
                 }
f83012
 
f83012
                 g_free (command);
f83012
         } else {
ffa191
                 /* FIXME:
ffa191
                  * Always use a separate DBus bus for each greeter session.
ffa191
                  * Firstly, this means that if we run multiple greeter session
ffa191
                  * (which we really should not do, but have to currently), then
ffa191
                  * each one will get its own DBus session bus.
ffa191
                  * But, we also explicitly do this for seat0, because that way
ffa191
                  * it cannot make use of systemd to run the GNOME session. This
ffa191
                  * prevents the session lookup logic from getting confused.
ffa191
                  * This has a similar effect as passing --builtin to gnome-session.
ffa191
                  *
ffa191
                  * We really should not be doing this. But the fix is to use
ffa191
                  * separate dynamically created users and that requires some
ffa191
                  * major refactorings.
ffa191
                  */
f83012
                 if (run_launcher) {
f83012
                         if (is_x11) {
ffa191
                                 program = g_strdup_printf (LIBEXECDIR "/gdm-x-session %s\"dbus-run-session -- %s\"",
ffa191
                                                            register_session ? "--register-session " : "",
ffa191
                                                            self->selected_program);
f83012
                         } else {
ffa191
                                 program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"dbus-run-session -- %s\"",
ffa191
                                                            register_session ? "--register-session " : "",
ffa191
                                                            self->selected_program);
f83012
                         }
f83012
-- 
ffa191
2.31.1
f83012