From b7b9f89417ab547b96dc5000ef5c6be9d0a307d5 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 30 Nov 2022 13:47:47 +0000 Subject: [PATCH] gdbusaddress: Use runstatedir rather than localstatedir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reworks commit 20e1508e6e743b4a1b1f4a19ed015121c26ae21b, for two reasons: - Upstream dbus.git now does the same (although this isn’t yet reflected in the online version of the D-Bus Specification); see https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/209. - It allows local-prefix (e.g. jhbuild) builds of GLib to build in a custom prefix while still interacting with system services using the system-wide `/run` directory. To do so, pass `-Druntime_dir=/run` to meson configure. As documented in the `NEWS` file in https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/209, it’s only valid to use `/run` – rather than `/var/run` – for D-Bus if the two paths are interoperable. i.e. `/var/run` should be a symlink to `/run`, and the D-Bus daemon should be configured to put its socket there. This commit deliberately doesn’t introduce a special `system_socket` configure option for specifying where the D-Bus system socket lives, as that would only be useful for a distribution which sets `runstatedir` to something other than `/var/run` or `/run`, which seems unlikely. We could add such an option in future, though, if a distribution comes forward with such a requirement. See discussion on https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3095#note_1605502. Signed-off-by: Philip Withnall --- NEWS | 12 ++++++++++++ gio/gdbusaddress.c | 6 ++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index c1fececb7..1a760dfff 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,15 @@ +UNRELEASED CHANGES +================== + +* Change the default D-Bus system bus socket address from + `/var/run/dbus/system_bus_socket` to `/run/dbus/system_bus_socket`, in line + with changes in dbus.git. This can now be overridden by passing + `-Druntime_dir=/some/path` at configure time — the default is `/run`, which + should work for all users except distributions where `/run` is not equivalent + to `/var/run`. OS distributors should check that this configured path matches + the runtime directory configured for their D-Bus daemon. (!3101) + + Overview of changes in GLib 2.75.0, 2022-11-10 ============================================== diff --git a/gio/gdbusaddress.c b/gio/gdbusaddress.c index c8c432e09..523b1b8d0 100644 --- a/gio/gdbusaddress.c +++ b/gio/gdbusaddress.c @@ -1339,8 +1339,10 @@ g_dbus_address_get_for_bus_sync (GBusType bus_type, { /* While the D-Bus specification says this must be `/var/run/dbus/system_bus_socket`, * a footnote allows it to use localstatedir: - * https://dbus.freedesktop.org/doc/dbus-specification.html#ftn.id-1.13.6.4.3.3 */ - ret = g_strdup ("unix:path=" GLIB_LOCALSTATEDIR "/run/dbus/system_bus_socket"); + * https://dbus.freedesktop.org/doc/dbus-specification.html#ftn.id-1.13.6.4.3.3 + * or, on systems where /run is the same as /var/run, runstatedir: + * https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/209 */ + ret = g_strdup ("unix:path=" GLIB_RUNSTATEDIR "/dbus/system_bus_socket"); } break;