from https://gitlab.gnome.org/GNOME/at-spi2-core/issues/18:
    When running at-spi-bus-launcher --launch-immediately several times
    in an X session, the first run creates the AT_SPI_BUS root X window
    property, but then the others drop it. The result is that when a
    user passes root with su -l (thus clearing all environment variables)
    but sets DISPLAY=:0 and XAUTHORITY to make graphical applications to
    access X, dbus auto-triggers an at-spi-bus-launcher again, which sets
    the AT_SPI_BUS property, and from then on we have mayhem in atspi
    with two concurrent atspi stacks running.

Merge request is here -> 
https://gitlab.gnome.org/GNOME/at-spi2-core/merge_requests/24

This would be triggered, ie, if an advanced user runs a program via su 
from the terminal and DBUS_SESSION_BUS_ADDRESS is not propagated. I don't 
think that it would be the end of the world if this fix has to wait for 
3.34.1, but, on the other hand, it fixes a regression introduced in the 
3.34 cycle, so I'd lean towards committing it if people approve.

Thanks,
-Mike
From 828048bfb4561c232dc668897f8203a3540edb0e Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thiba...@ens-lyon.org>
Date: Fri, 6 Sep 2019 03:33:51 +0200
Subject: [PATCH 1/3] at-spi-bus-launcher: clear a11y_bus_pid when failing to
 read address

This may happen if dbus-daemon spawns but fails to start. In that case after
terminating it we should forget its pid, to avoid trying to terminate it
again at the end of main().
---
 bus/at-spi-bus-launcher.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c
index 6cb625c..57727c1 100644
--- a/bus/at-spi-bus-launcher.c
+++ b/bus/at-spi-bus-launcher.c
@@ -323,6 +323,7 @@ ensure_a11y_bus_daemon (A11yBusLauncher *app, char *config_path)
     {
       app->a11y_launch_error_message = g_strdup_printf ("Failed to read address: %s", strerror (errno));
       kill (app->a11y_bus_pid, SIGTERM);
+      app->a11y_bus_pid = -1;
       goto error;
     }
   close (app->pipefd[0]);
-- 
2.22.0


From 1e43ac742c7622beaa40902777a017efa3af2402 Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thiba...@ens-lyon.org>
Date: Fri, 6 Sep 2019 03:39:30 +0200
Subject: [PATCH 2/3] at-spi-bus-launcher: Only clear AT_SPI_BUS X prop when
 having set it

In case where bus name acquisition fails, we shall not drop the
AT_SPI_BUS X property of the existing daemon.
---
 bus/at-spi-bus-launcher.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c
index 57727c1..af85f04 100644
--- a/bus/at-spi-bus-launcher.c
+++ b/bus/at-spi-bus-launcher.c
@@ -63,6 +63,9 @@ typedef struct {
   /* -1 == error, 0 == pending, > 0 == running */
   int a11y_bus_pid;
   char *a11y_bus_address;
+#ifdef HAVE_X11
+  gboolean x11_prop_set;
+#endif
   int pipefd[2];
   int listenfd;
   char *a11y_launch_error_message;
@@ -480,6 +483,7 @@ ensure_a11y_bus (A11yBusLauncher *app)
                            (guchar *) app->a11y_bus_address, strlen (app->a11y_bus_address));
           XFlush (display);
           XCloseDisplay (display);
+          app->x11_prop_set = TRUE;
         }
     }
 #endif
@@ -886,7 +890,7 @@ main (int    argc,
    * we don't want early login processes to pick up the stale address.
    */
 #ifdef HAVE_X11
-  if (g_getenv ("DISPLAY") != NULL && g_getenv ("WAYLAND_DISPLAY") == NULL)
+  if (_global_app->x11_prop_set)
     {
       Display *display = XOpenDisplay (NULL);
       if (display)
-- 
2.22.0


From 018443b7a8ad0b6f068c2255adcb49037a388d15 Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thiba...@ens-lyon.org>
Date: Fri, 6 Sep 2019 03:40:53 +0200
Subject: [PATCH 3/3] at-spi-bus-launcher: defer starting atspi bus after bus
 name acquired

In case bus name acquisition fails, we should not have started a bus
after all, but worse, we should not have written its address in the
AT_SPI_BUS X root property. We should thus do them only after having
acquired the bus name.
---
 bus/at-spi-bus-launcher.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c
index af85f04..b4f49b8 100644
--- a/bus/at-spi-bus-launcher.c
+++ b/bus/at-spi-bus-launcher.c
@@ -683,16 +683,6 @@ on_bus_acquired (GDBusConnection *connection,
     }
   app->session_bus = connection;
 
-  if (app->launch_immediately)
-    {
-      ensure_a11y_bus (app);
-      if (app->state == A11Y_BUS_STATE_ERROR)
-        {
-          g_main_loop_quit (app->loop);
-          return;
-        }
-    }
-
   error = NULL;
   registration_id = g_dbus_connection_register_object (connection,
                                                        "/org/a11y/bus",
@@ -734,6 +724,18 @@ on_name_acquired (GDBusConnection *connection,
                   const gchar     *name,
                   gpointer         user_data)
 {
+  A11yBusLauncher *app = user_data;
+
+  if (app->launch_immediately)
+    {
+      ensure_a11y_bus (app);
+      if (app->state == A11Y_BUS_STATE_ERROR)
+        {
+          g_main_loop_quit (app->loop);
+          return;
+        }
+    }
+
   g_bus_watch_name (G_BUS_TYPE_SESSION,
                     "org.gnome.SessionManager",
                     G_BUS_NAME_WATCHER_FLAGS_NONE,
-- 
2.22.0

_______________________________________________
release-team@gnome.org
https://mail.gnome.org/mailman/listinfo/release-team
Release-team lurker? Do NOT participate in discussions.

Reply via email to