summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@gnome.org>2020-09-24 20:06:44 +0000
committerMichael Catanzaro <mcatanzaro@gnome.org>2020-09-24 20:44:49 +0000
commit4eab0d172ba8ba31f7a1f55d48c53f57556fda3c (patch)
treec9abb91b32832bab1990db42105da1826a72a90b
parent4654c91696460b9eba1592252f5528c4c37de00e (diff)
downloadat-spi2-core-gnome-3-36.tar.gz
Don't use dbus-broker if not running under systemdgnome-3-36
Since gdm@febeb9a9, gdm no longer runs a systemd user session, because gdm supports multiseat but systemd only allows one graphical session per user. Since gdm currently runs as the gdm user, that means we cannot use systemd there. Benjamin Berg says we could fix that by changing gdm to use temporary users for each seat, but that would be a lot of work. Meanwhile, dbus-broker relies on systemd to autostart D-Bus services. So if we are not running a systemd user session, nothing gets autostarted in response to D-Bus calls. That means orca never gets any response to its method calls to org.a11y.atspi.Registry, and we wind up with no accessibility on the gnome-shell login screen. Fix this by implementing Benjamin's suggested check to see if we are running under systemd before using dbus-broker. So now we will use dbus-daemon on the login screen, but we will still use dbus-broker for the user session (except in distros that still prefer dbus-daemon... which is actually the default configuration). libsystemd is added as a build dependency whenever built with dbus-broker support, which should be uncontroversial because it won't work without systemd. I expect dbus-daemon is going to live alongside dbus-broker for a long time, because it seems very hard for us to migrate fully. Big thanks to Benjamin Berg for discovering the problem and suggesting this solution. Fixes #25 (cherry picked from commit 260a4414ac26cc5e91dc56b6a10b5dda3dae22cd)
-rw-r--r--bus/at-spi-bus-launcher.c18
-rw-r--r--bus/meson.build11
2 files changed, 28 insertions, 1 deletions
diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c
index 362fd05f..d7c66900 100644
--- a/bus/at-spi-bus-launcher.c
+++ b/bus/at-spi-bus-launcher.c
@@ -39,6 +39,9 @@
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#endif
+#ifdef DBUS_BROKER
+#include <systemd/sd-login.h>
+#endif
typedef enum {
A11Y_BUS_STATE_IDLE = 0,
@@ -392,11 +395,26 @@ static gboolean
ensure_a11y_bus_broker (A11yBusLauncher *app, char *config_path)
{
char *argv[] = { DBUS_BROKER, config_path, "--scope", "user", NULL };
+ char *unit;
struct sockaddr_un addr = { .sun_family = AF_UNIX };
socklen_t addr_len = sizeof(addr);
GPid pid;
GError *error = NULL;
+ /* This detects whether we are running under systemd. We only try to
+ * use dbus-broker if we are running under systemd because D-Bus
+ * service activation won't work otherwise.
+ */
+ if (sd_pid_get_user_unit (getpid (), &unit) >= 0)
+ {
+ free (unit);
+ }
+ else
+ {
+ app->state = A11Y_BUS_STATE_ERROR;
+ return FALSE;
+ }
+
if ((app->listenfd = socket (PF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0)) < 0)
g_error ("Failed to create listening socket: %s", strerror (errno));
diff --git a/bus/meson.build b/bus/meson.build
index 0fff5a89..f6c32c99 100644
--- a/bus/meson.build
+++ b/bus/meson.build
@@ -48,13 +48,16 @@ else
endif
endif
+needs_systemd = false
if get_option('dbus_broker') != 'default'
launcher_args += '-DDBUS_BROKER="@0@"'.format(get_option('dbus_broker'))
+ needs_systemd = true
else
dbus_broker = find_program('dbus-broker-launch',
required: false)
if dbus_broker.found()
launcher_args += '-DDBUS_BROKER="@0@"'.format(dbus_broker.path())
+ needs_systemd = true
endif
endif
@@ -62,9 +65,15 @@ if get_option('default_bus') == 'dbus-broker'
launcher_args += '-DWANT_DBUS_BROKER'
endif
+if needs_systemd
+ systemd_dep = dependency('libsystemd')
+else
+ systemd_dep = dependency('', required: false)
+endif
+
executable('at-spi-bus-launcher', 'at-spi-bus-launcher.c',
include_directories: [ root_inc, include_directories('.') ],
- dependencies: [ gio_dep, x11_deps ],
+ dependencies: [ gio_dep, systemd_dep, x11_deps ],
c_args: launcher_args,
install: true,
install_dir: atspi_libexecdir)