]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
build: Put system bus socket in runstatedir by default
authorIssam E. Maghni <issam.e.maghni@mailbox.org>
Sat, 19 Jun 2021 01:20:21 +0000 (21:20 -0400)
committerSimon McVittie <smcv@collabora.com>
Tue, 11 Oct 2022 16:14:11 +0000 (17:14 +0100)
This lets OS distributors configure --runstatedir=/run if they want to,
although for interoperability, they should only do this if they can
guarantee that their /run and /var/run are equivalent.

A previous commit adds a warning if we are using the default path on a
system where /run and /var/run are not synoymous, mitigating the
compatibility impact of this change.

For CMake, this requires version 3.9, released in 2017.

For Meson, this is currently controlled by the runtime_dir option,
which defaults to /run if the prefix is /usr. The rationale for this
is that /run is correct for modern Unix systems, and distributors who
switch from Autotools or CMake to Meson need to review all their build
options at that time, which is an ideal opportunity to check that they
are doing the right thing around /run.

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/180
Co-authored-by: Simon McVittie <smcv@collabora.com>
CMakeLists.txt
bus/Makefile.am
bus/meson.build
configure.ac
meson.build

index 6996f61e62a15d3f0aa3dccd59253d14f65f5a8a..2dd95e989d74485068a5cb763a23d0031a1e853a 100644 (file)
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.4)
+cmake_minimum_required(VERSION 3.9)
 
 # we do not need to have WIN32 defined
 set(CMAKE_LEGACY_CYGWIN_WIN32 0)
@@ -71,7 +71,7 @@ set(DBUS_MACHINE_UUID_FILE   ${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/dbus/machin
 set(DBUS_BINDIR              ${CMAKE_INSTALL_FULL_BINDIR})
 set(DBUS_DAEMONDIR           ${CMAKE_INSTALL_FULL_BINDIR})
 set(DBUS_LOCALSTATEDIR       ${CMAKE_INSTALL_FULL_LOCALSTATEDIR})
-set(DBUS_RUNSTATEDIR         ${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run)
+set(DBUS_RUNSTATEDIR         ${CMAKE_INSTALL_FULL_RUNSTATEDIR})
 
 # On Windows this is relative to where we put the bus setup, in
 # ${datadir}/dbus-1. For simplicity, we only do this if
index 51a8de819517537f7c873d3272cbbcbf8762fca8..1f5017c5d95d798005b1d5618761facbaa545b67 100644 (file)
@@ -185,7 +185,7 @@ install-data-hook:
        $(mkinstalldirs) $(DESTDIR)$(dbusdatadir)/session.d
        $(mkinstalldirs) $(DESTDIR)$(dbusdatadir)/services
 if DBUS_UNIX
-       $(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus
+       $(mkinstalldirs) $(DESTDIR)$(runstatedir)/dbus
        $(mkinstalldirs) $(DESTDIR)$(dbusdatadir)/system.d
        $(mkinstalldirs) $(DESTDIR)$(dbusdatadir)/system-services
 endif
index 1aaaf48dc9487f7351290b78cc0133facea5e9b2..058e3b25a4594e56ba9ef7cd49f5c136fa143dfc 100644 (file)
@@ -191,7 +191,7 @@ install_emptydirs += [
 
 if platform_unix
     install_emptydirs += [
-        get_option('localstatedir') / 'run' / 'dbus',
+        runstatedir / 'dbus',
         get_option('datadir') / 'dbus-1' / 'system.d',
         get_option('datadir') / 'dbus-1' / 'system-services',
     ]
index ca7043443e2b0b3d94125af62d57c76981c9f024..7da53d5d8e1f345d91ec3e4495f075847e80ef00 100644 (file)
@@ -1331,14 +1331,9 @@ AC_SUBST([systemduserunitdir], [$with_systemduserunitdir])
 
 ##### Set up location for system bus socket
 
-AS_IF([! test -z "$with_system_socket"],
+AS_IF([test -n "$with_system_socket"],
    [DBUS_SYSTEM_SOCKET=$with_system_socket],
-   [
-   # We don't use runstatedir for this (yet?), because /var/run has been the
-   # interoperable system bus socket for 10+ years.
-   # See https://bugs.freedesktop.org/show_bug.cgi?id=101628
-   DBUS_SYSTEM_SOCKET=${EXPANDED_LOCALSTATEDIR}/run/dbus/system_bus_socket
-   ])
+   [DBUS_SYSTEM_SOCKET=${EXPANDED_RUNSTATEDIR}/dbus/system_bus_socket])
 
 dnl The actual check script is shared between Autotools and CMake.
 AS_IF([test "$dbus_win" != yes],
index caaaccf20780f7dbd0492ec794d5ab5c18e01257..33294e2e6b111742215994dd1d0ea93dbda4cdcc 100644 (file)
@@ -822,13 +822,8 @@ config.set_quoted('DBUS_SESSION_CONFIG_FILE',
 
 system_socket = get_option('system_socket')
 if system_socket == ''
-    # We don't use runstatedir for this (yet?), because /var/run has been the
-    # interoperable system bus socket for 10+ years.
-    # See https://bugs.freedesktop.org/show_bug.cgi?id=101628
     system_socket = (
-        get_option('prefix')
-        / get_option('localstatedir')
-        /'run'/'dbus'/'system_bus_socket'
+        get_option('prefix') / runstatedir / 'dbus' / 'system_bus_socket'
     )
 endif