Skip to content

Use ${runstatedir} for system bus instead of ${localstatedir}/run

Issam E. Maghni requested to merge iemaghni/dbus:autoconf-runstatedir into master
  • build: Use AS_IF for system bus socket

    From: @smcv

  • build: Update a comment with the release status of Autoconf

    From: @smcv

    It took a while, but Autoconf 2.70 was eventually released.

  • build: Show a warning if the system bus socket is not interoperable

    From: @smcv

    We would like to start using ${runstatedir}/dbus/system_bus_socket, so that distributors who make /var/run a symbolic link to /run will usually get their dbus-daemon listening on /run/dbus/system_bus_socket, which has some advantages in corner cases, such as when /var is mediated by an automounter or is unmounted during system shutdown.

    Unfortunately, the interoperable path in the D-Bus Specification is /var/run/dbus/system_bus_socket for historical reasons (D-Bus is older than /run), and older versions of Slackware are known to have had /run and /var/run as distinct directories. Do a check during configuration to catch systems configured like this and show a warning.

    When cross-compiling, this assumes that the system where dbus is built (the build system in Autotools/Meson, or the "host" in CMake terminology) has its /var/run and /run set up in a way that is compatible with the system where dbus will run (the host system in Autotools/Meson, or the "target" in CMake terminology). This is not 100% correct, but seems good enough for a warning that will hopefully only trigger for misguided OS distributors.

  • build: Put system bus socket in runstatedir by default

    From: @iemaghni

    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: #180 (closed)
    Co-authored-by: @smcv

  • spec: Mention that the system bus address might actually be in /run

    The interoperable address is unix:path=/var/run/dbus/system_bus_socket. However, in most (perhaps all) current Linux distributions, /var/run is guaranteed to be a symbolic link to /run, and using the path in /run has some advantages (particularly if automounters are used).

    Implementations that intend to be interoperable are not required to listen on exactly /var/run/dbus/system_bus_socket, as long as clients that connect to that socket will work correctly. Similarly, clients are not required to connect to exactly /var/run/dbus/system_bus_socket, as long as the overall system (consisting of the client and the OSs that it supports) ensures that it ends up connecting to the same well-known system bus that is available at /var/run/dbus/system_bus_socket.

    Because of the Unix conventions for how software installs into a prefix, building a D-Bus implementation with its default build-time configuration options will not necessarily result in an interoperable system bus. The system bus is normally shipped by OS distributors, who should ensure that they have configured it in a way that is interoperable.

    Resolves: #180 (closed)

  • Add NEWS entries for #180 (closed)

    From: @smcv

Edited by Simon McVittie

Merge request reports