at-spi2-core: use dbus-broker if available
The at-spi2-core now has upstream support for alternative bus-implementations, mainly 'dbus-broker' over 'dbus-daemon'. If a path to either binary is provided at compile time, at-spi2 will try the given bus implementation at runtime. Since Fedora provides two alternatives, we make at-spi2 use both. Note that at-spi2 falls back to the alternative if the primary pick is not available. We keep the 'Requires: dbus' dependency. The 'dbus' package was turned into a meta-package. Right now it pulls in either 'dbus-daemon' or 'dbus-broker', but in the future it will be a real meta-package and be 'Provides: dbus' by both dbus-daemon and dbus-broker. Hence, the depdency is sufficient to guarantee that at least one bus implementation is available on the machine. Given that dbus-broker will be the default bus implementation in F29, this patch also switches the at-spi2 default to 'dbus-broker'. Again, this will safely fall-back to 'dbus-daemon' at runtime if dbus-broker is unavailable. (dvdhrm: This is based on zbyszek's original patch, but now highly modified by me.) v2: - fix __linux__ vs __linux preprocessor define v3: - backport the __linux__ fix to 2.28.0 to make it apply cleanly
This commit is contained in:
parent
bf27531666
commit
3af57777ad
41
0001-bus-launch-use-__linux__-over-__linux.patch
Normal file
41
0001-bus-launch-use-__linux__-over-__linux.patch
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
From 85dedf4125d2107a4b095bbafe482bf6ecfd06f1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Herrmann <dh.herrmann@gmail.com>
|
||||||
|
Date: Fri, 10 Aug 2018 16:35:31 +0200
|
||||||
|
Subject: [PATCH] bus-launch: use __linux__ over __linux
|
||||||
|
|
||||||
|
The canonical way to check for linux support is '__linux__', not
|
||||||
|
'__linux'. Particularly, on ppc64le '__linux' is not defined and the
|
||||||
|
build will fail.
|
||||||
|
|
||||||
|
For reference, see:
|
||||||
|
|
||||||
|
https://sourceforge.net/p/predef/wiki/OperatingSystems/
|
||||||
|
---
|
||||||
|
bus/at-spi-bus-launcher.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c
|
||||||
|
index 8aeb490..8fa566f 100644
|
||||||
|
--- a/bus/at-spi-bus-launcher.c
|
||||||
|
+++ b/bus/at-spi-bus-launcher.c
|
||||||
|
@@ -25,7 +25,7 @@
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
|
-#ifdef __linux
|
||||||
|
+#ifdef __linux__
|
||||||
|
#include <sys/prctl.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/un.h>
|
||||||
|
@@ -232,7 +232,7 @@ setup_bus_child_daemon (gpointer data)
|
||||||
|
close (app->pipefd[1]);
|
||||||
|
|
||||||
|
/* On Linux, tell the bus process to exit if this process goes away */
|
||||||
|
-#ifdef __linux
|
||||||
|
+#ifdef __linux__
|
||||||
|
prctl (PR_SET_PDEATHSIG, 15);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.18.0
|
||||||
|
|
299
09e012860a6e1e074ac1950a4afc3d4131d046d9.patch
Normal file
299
09e012860a6e1e074ac1950a4afc3d4131d046d9.patch
Normal file
@ -0,0 +1,299 @@
|
|||||||
|
From 09e012860a6e1e074ac1950a4afc3d4131d046d9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tom Gundersen <teg@jklm.no>
|
||||||
|
Date: Thu, 1 Mar 2018 12:00:09 +0100
|
||||||
|
Subject: [PATCH] bus-launch: add dbus-broker support
|
||||||
|
|
||||||
|
If dbus-broker is enabled at compile-time and found at run-time prefer that
|
||||||
|
over dbus-daemon.
|
||||||
|
|
||||||
|
Unlike with dbus-daemon, this means that at-spi-bus-launch must create the
|
||||||
|
listening socket and pass it in, rather than having the bus do that and send
|
||||||
|
back the address. For now we follow what dbus-daemon does, and create a socket
|
||||||
|
in the abstract namespace, though it might be more suitable to create a socket
|
||||||
|
in $XDG_RUNTIME_DIR.
|
||||||
|
|
||||||
|
The only difference users should observe is that daemons are no longer spawned
|
||||||
|
by the bus implementation, but spawned and managed by the systemd user instance,
|
||||||
|
though this should not lead to a difference in behavior. In particular this
|
||||||
|
applies to `org.a11y.atspi.Registry`.
|
||||||
|
|
||||||
|
For non-linux and non-systemd systems, dbus-daemon should continue to be used.
|
||||||
|
|
||||||
|
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
||||||
|
---
|
||||||
|
bus/at-spi-bus-launcher.c | 145 ++++++++++++++++++++++++++++++++++++++--------
|
||||||
|
bus/meson.build | 27 +++++++--
|
||||||
|
meson_options.txt | 4 ++
|
||||||
|
3 files changed, 147 insertions(+), 29 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c
|
||||||
|
index eb2b8e3..8aeb490 100644
|
||||||
|
--- a/bus/at-spi-bus-launcher.c
|
||||||
|
+++ b/bus/at-spi-bus-launcher.c
|
||||||
|
@@ -2,7 +2,7 @@
|
||||||
|
*
|
||||||
|
* at-spi-bus-launcher: Manage the a11y bus as a child process
|
||||||
|
*
|
||||||
|
- * Copyright 2011 Red Hat, Inc.
|
||||||
|
+ * Copyright 2011-2018 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@@ -25,6 +25,11 @@
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
|
+#ifdef __linux
|
||||||
|
+#include <sys/prctl.h>
|
||||||
|
+#include <sys/socket.h>
|
||||||
|
+#include <sys/un.h>
|
||||||
|
+#endif
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
@@ -58,6 +63,7 @@ typedef struct {
|
||||||
|
int a11y_bus_pid;
|
||||||
|
char *a11y_bus_address;
|
||||||
|
int pipefd[2];
|
||||||
|
+ int listenfd;
|
||||||
|
char *a11y_launch_error_message;
|
||||||
|
} A11yBusLauncher;
|
||||||
|
|
||||||
|
@@ -216,7 +222,7 @@ name_appeared_handler (GDBusConnection *connection,
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
-setup_bus_child (gpointer data)
|
||||||
|
+setup_bus_child_daemon (gpointer data)
|
||||||
|
{
|
||||||
|
A11yBusLauncher *app = data;
|
||||||
|
(void) app;
|
||||||
|
@@ -227,7 +233,6 @@ setup_bus_child (gpointer data)
|
||||||
|
|
||||||
|
/* On Linux, tell the bus process to exit if this process goes away */
|
||||||
|
#ifdef __linux
|
||||||
|
-#include <sys/prctl.h>
|
||||||
|
prctl (PR_SET_PDEATHSIG, 15);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@@ -277,23 +282,12 @@ on_bus_exited (GPid pid,
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
-ensure_a11y_bus (A11yBusLauncher *app)
|
||||||
|
+ensure_a11y_bus_daemon (A11yBusLauncher *app, char *config_path)
|
||||||
|
{
|
||||||
|
+ char *argv[] = { DBUS_DAEMON, config_path, "--nofork", "--print-address", "3", NULL };
|
||||||
|
GPid pid;
|
||||||
|
- char *argv[] = { DBUS_DAEMON, NULL, "--nofork", "--print-address", "3", NULL };
|
||||||
|
char addr_buf[2048];
|
||||||
|
GError *error = NULL;
|
||||||
|
- const char *config_path = NULL;
|
||||||
|
-
|
||||||
|
- if (app->a11y_bus_pid != 0)
|
||||||
|
- return FALSE;
|
||||||
|
-
|
||||||
|
- if (g_file_test (SYSCONFDIR"/at-spi2/accessibility.conf", G_FILE_TEST_EXISTS))
|
||||||
|
- config_path = "--config-file="SYSCONFDIR"/at-spi2/accessibility.conf";
|
||||||
|
- else
|
||||||
|
- config_path = "--config-file="DATADIR"/defaults/at-spi2/accessibility.conf";
|
||||||
|
-
|
||||||
|
- argv[1] = config_path;
|
||||||
|
|
||||||
|
if (pipe (app->pipefd) < 0)
|
||||||
|
g_error ("Failed to create pipe: %s", strerror (errno));
|
||||||
|
@@ -302,7 +296,7 @@ ensure_a11y_bus (A11yBusLauncher *app)
|
||||||
|
argv,
|
||||||
|
NULL,
|
||||||
|
G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
|
||||||
|
- setup_bus_child,
|
||||||
|
+ setup_bus_child_daemon,
|
||||||
|
app,
|
||||||
|
&pid,
|
||||||
|
&error))
|
||||||
|
@@ -335,6 +329,116 @@ ensure_a11y_bus (A11yBusLauncher *app)
|
||||||
|
app->a11y_bus_address = g_strchomp (g_strdup (addr_buf));
|
||||||
|
g_debug ("a11y bus address: %s", app->a11y_bus_address);
|
||||||
|
|
||||||
|
+ return TRUE;
|
||||||
|
+
|
||||||
|
+error:
|
||||||
|
+ close (app->pipefd[0]);
|
||||||
|
+ close (app->pipefd[1]);
|
||||||
|
+ app->state = A11Y_BUS_STATE_ERROR;
|
||||||
|
+
|
||||||
|
+ return FALSE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#ifdef DBUS_BROKER
|
||||||
|
+static void
|
||||||
|
+setup_bus_child_broker (gpointer data)
|
||||||
|
+{
|
||||||
|
+ A11yBusLauncher *app = data;
|
||||||
|
+ gchar *pid_str;
|
||||||
|
+ (void) app;
|
||||||
|
+
|
||||||
|
+ dup2 (app->listenfd, 3);
|
||||||
|
+ close (app->listenfd);
|
||||||
|
+ g_setenv("LISTEN_FDS", "1", TRUE);
|
||||||
|
+
|
||||||
|
+ pid_str = g_strdup_printf("%u", getpid());
|
||||||
|
+ g_setenv("LISTEN_PID", pid_str, TRUE);
|
||||||
|
+ g_free(pid_str);
|
||||||
|
+
|
||||||
|
+ /* Tell the bus process to exit if this process goes away */
|
||||||
|
+ prctl (PR_SET_PDEATHSIG, SIGTERM);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static gboolean
|
||||||
|
+ensure_a11y_bus_broker (A11yBusLauncher *app, char *config_path)
|
||||||
|
+{
|
||||||
|
+ char *argv[] = { DBUS_BROKER, config_path, "--scope", "user", "--verbose", NULL };
|
||||||
|
+ struct sockaddr_un addr = { .sun_family = AF_UNIX };
|
||||||
|
+ socklen_t addr_len = sizeof(addr);
|
||||||
|
+ GPid pid;
|
||||||
|
+ GError *error = NULL;
|
||||||
|
+
|
||||||
|
+ if ((app->listenfd = socket (PF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0)) < 0)
|
||||||
|
+ g_error ("Failed to create listening socket: %s", strerror (errno));
|
||||||
|
+
|
||||||
|
+ if (bind (app->listenfd, (struct sockaddr *)&addr, sizeof(sa_family_t)) < 0)
|
||||||
|
+ g_error ("Failed to bind listening socket: %s", strerror (errno));
|
||||||
|
+
|
||||||
|
+ if (getsockname (app->listenfd, (struct sockaddr *)&addr, &addr_len) < 0)
|
||||||
|
+ g_error ("Failed to get socket name for listening socket: %s", strerror(errno));
|
||||||
|
+
|
||||||
|
+ if (listen (app->listenfd, 1024) < 0)
|
||||||
|
+ g_error ("Failed to listen on socket: %s", strerror(errno));
|
||||||
|
+
|
||||||
|
+ if (!g_spawn_async (NULL,
|
||||||
|
+ argv,
|
||||||
|
+ NULL,
|
||||||
|
+ G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
|
||||||
|
+ setup_bus_child_broker,
|
||||||
|
+ app,
|
||||||
|
+ &pid,
|
||||||
|
+ &error))
|
||||||
|
+ {
|
||||||
|
+ app->a11y_bus_pid = -1;
|
||||||
|
+ app->a11y_launch_error_message = g_strdup (error->message);
|
||||||
|
+ g_clear_error (&error);
|
||||||
|
+ goto error;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ close (app->listenfd);
|
||||||
|
+ app->listenfd = -1;
|
||||||
|
+
|
||||||
|
+ g_child_watch_add (pid, on_bus_exited, app);
|
||||||
|
+ app->a11y_bus_pid = pid;
|
||||||
|
+ g_debug ("Launched a11y bus, child is %ld", (long) pid);
|
||||||
|
+ app->state = A11Y_BUS_STATE_RUNNING;
|
||||||
|
+
|
||||||
|
+ app->a11y_bus_address = g_strconcat("unix:abstract=", addr.sun_path + 1, NULL);
|
||||||
|
+ g_debug ("a11y bus address: %s", app->a11y_bus_address);
|
||||||
|
+
|
||||||
|
+ return TRUE;
|
||||||
|
+
|
||||||
|
+error:
|
||||||
|
+ close (app->listenfd);
|
||||||
|
+ app->state = A11Y_BUS_STATE_ERROR;
|
||||||
|
+
|
||||||
|
+ return FALSE;
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+static gboolean
|
||||||
|
+ensure_a11y_bus (A11yBusLauncher *app)
|
||||||
|
+{
|
||||||
|
+ char *config_path = NULL;
|
||||||
|
+ gboolean success = FALSE;
|
||||||
|
+
|
||||||
|
+ if (app->a11y_bus_pid != 0)
|
||||||
|
+ return FALSE;
|
||||||
|
+
|
||||||
|
+ if (g_file_test (SYSCONFDIR"/at-spi2/accessibility.conf", G_FILE_TEST_EXISTS))
|
||||||
|
+ config_path = "--config-file="SYSCONFDIR"/at-spi2/accessibility.conf";
|
||||||
|
+ else
|
||||||
|
+ config_path = "--config-file="DATADIR"/defaults/at-spi2/accessibility.conf";
|
||||||
|
+
|
||||||
|
+#ifdef DBUS_BROKER
|
||||||
|
+ success = ensure_a11y_bus_broker (app, config_path);
|
||||||
|
+#endif
|
||||||
|
+ if (!success)
|
||||||
|
+ {
|
||||||
|
+ if (!ensure_a11y_bus_daemon (app, config_path))
|
||||||
|
+ return FALSE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
#ifdef HAVE_X11
|
||||||
|
{
|
||||||
|
Display *display = XOpenDisplay (NULL);
|
||||||
|
@@ -353,13 +457,6 @@ ensure_a11y_bus (A11yBusLauncher *app)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
-
|
||||||
|
- error:
|
||||||
|
- close (app->pipefd[0]);
|
||||||
|
- close (app->pipefd[1]);
|
||||||
|
- app->state = A11Y_BUS_STATE_ERROR;
|
||||||
|
-
|
||||||
|
- return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
diff --git a/bus/meson.build b/bus/meson.build
|
||||||
|
index 909103c..ba8ea2c 100644
|
||||||
|
--- a/bus/meson.build
|
||||||
|
+++ b/bus/meson.build
|
||||||
|
@@ -43,13 +43,30 @@ else
|
||||||
|
required: true).path()
|
||||||
|
endif
|
||||||
|
|
||||||
|
-executable('at-spi-bus-launcher', 'at-spi-bus-launcher.c',
|
||||||
|
- include_directories: [ root_inc, include_directories('.') ],
|
||||||
|
- dependencies: [ gio_dep, x11_deps ],
|
||||||
|
- c_args: [
|
||||||
|
+launcher_args = [
|
||||||
|
'-DSYSCONFDIR="@0@"'.format(atspi_sysconfdir),
|
||||||
|
'-DDATADIR="@0@"'.format(atspi_datadir),
|
||||||
|
'-DDBUS_DAEMON="@0@"'.format(dbus_daemon),
|
||||||
|
- ],
|
||||||
|
+ ]
|
||||||
|
+
|
||||||
|
+if get_option('dbus_broker') != 'default'
|
||||||
|
+ launcher_args += '-DDBUS_BROKER="@0@"'.format(get_option('dbus_broker'))
|
||||||
|
+else
|
||||||
|
+ dbus_broker = find_program('dbus-broker-launch',
|
||||||
|
+ '/sbin/dbus-broker-launch',
|
||||||
|
+ '/usr/sbin/dbus-broker-launch',
|
||||||
|
+ '/libexec/dbus-broker-launch',
|
||||||
|
+ '/usr/libexec/dbus-broker-launch',
|
||||||
|
+ '/usr/pkg/bin/dbus-broker-launch',
|
||||||
|
+ required: false)
|
||||||
|
+ if dbus_broker.found()
|
||||||
|
+ launcher_args += '-DDBUS_BROKER="@0@"'.format(dbus_broker.path())
|
||||||
|
+ endif
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+executable('at-spi-bus-launcher', 'at-spi-bus-launcher.c',
|
||||||
|
+ include_directories: [ root_inc, include_directories('.') ],
|
||||||
|
+ dependencies: [ gio_dep, x11_deps ],
|
||||||
|
+ c_args: launcher_args,
|
||||||
|
install: true,
|
||||||
|
install_dir: atspi_libexecdir)
|
||||||
|
diff --git a/meson_options.txt b/meson_options.txt
|
||||||
|
index c9afe2f..494e83a 100644
|
||||||
|
--- a/meson_options.txt
|
||||||
|
+++ b/meson_options.txt
|
||||||
|
@@ -6,6 +6,10 @@ option('dbus_daemon',
|
||||||
|
description: 'The path of the DBus daemon',
|
||||||
|
type: 'string',
|
||||||
|
value: 'default')
|
||||||
|
+option('dbus_broker',
|
||||||
|
+ description: 'The path of the DBus broker',
|
||||||
|
+ type: 'string',
|
||||||
|
+ value: 'default')
|
||||||
|
option('systemd_user_dir',
|
||||||
|
description: 'Location of the systemd user services',
|
||||||
|
type: 'string',
|
@ -1,11 +1,13 @@
|
|||||||
Name: at-spi2-core
|
Name: at-spi2-core
|
||||||
Version: 2.28.0
|
Version: 2.28.0
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
Summary: Protocol definitions and daemon for D-Bus at-spi
|
Summary: Protocol definitions and daemon for D-Bus at-spi
|
||||||
|
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
URL: http://www.linuxfoundation.org/en/AT-SPI_on_D-Bus
|
URL: http://www.linuxfoundation.org/en/AT-SPI_on_D-Bus
|
||||||
Source0: http://download.gnome.org/sources/at-spi2-core/2.28/%{name}-%{version}.tar.xz
|
Source0: http://download.gnome.org/sources/at-spi2-core/2.28/%{name}-%{version}.tar.xz
|
||||||
|
Patch0: https://github.com/GNOME/at-spi2-core/commit/09e012860a6e1e074ac1950a4afc3d4131d046d9.patch
|
||||||
|
Patch1: 0001-bus-launch-use-__linux__-over-__linux.patch
|
||||||
|
|
||||||
BuildRequires: dbus-devel
|
BuildRequires: dbus-devel
|
||||||
BuildRequires: gettext
|
BuildRequires: gettext
|
||||||
@ -38,10 +40,10 @@ The at-spi2-core-devel package includes the header files and
|
|||||||
API documentation for libatspi.
|
API documentation for libatspi.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%autosetup -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%meson -Denable_docs=true
|
%meson -Denable_docs=true -Ddefault_bus=dbus-broker -Ddbus_daemon=/usr/bin/dbus-daemon -Ddbus_broker=/usr/bin/dbus-broker-launch
|
||||||
%meson_build
|
%meson_build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
@ -78,6 +80,9 @@ API documentation for libatspi.
|
|||||||
%{_libdir}/pkgconfig/atspi-2.pc
|
%{_libdir}/pkgconfig/atspi-2.pc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Aug 10 2018 David Herrmann <dh.herrmann@gmail.com> - 2.28.0-3
|
||||||
|
- Add support for dbus-broker alongside dbus-daemon
|
||||||
|
|
||||||
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.28.0-2
|
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.28.0-2
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user