Getting into the `if (timeout == NULL)` block means that
timeout_milliseconds == -1, so it doesn't make sense to do arithmetic on it.
Pass -1 instead of a nonsensical value in this case
It's unexpected to have DBUS_SESSION_SOCKET_DIR take different values in
CMakeCache.txt, which lists the variables that are available to be set
by the caller, and in config.h, which makes their final values available
to the C code. If DBUS_SESSION_SOCKET_DIR is empty and we are running
on Unix, set it to its dynamically-chosen fallback before storing it in
the cache.
[smcv: Add commit message]
Co-authored-by: Simon McVittie <smcv@collabora.com>
When the ancestor of this code was introduced in 2003 (commit e45e4382),
it was presumably most common to have these variables either unset, or
set to a value that is system-wide and remains valid in the long term,
such as /tmp or /var/tmp.
However, on modern systems they are sometimes set to a value that is
itself temporary, for example /var/folders/${some_long_path}/T on macOS,
or user-specific, for example /tmp/user/$(id -u) on Linux with
libpam-tmpdir. These values are certainly not useful to hard-code into
libdbus and dbus-daemon during installation: they will not be usable
when running dbus-related programs after a reboot or as a different user.
So, instead of assuming TMPDIR, TEMP and TMP remain valid long-term,
we now hard-code /tmp as our default.
As before, system integrators can override this default with
`-Dsession_socket_dir=...` (Meson) or `-DDBUS_SESSION_SOCKET_DIR=...`
(CMake) if a different directory is more appropriate than /tmp.
However, system integrators should note that because AF_UNIX paths have
a relatively short length limit (typically 108 bytes), a short path is
better than a long path in this context.
Resolves: dbus/dbus#551
Signed-off-by: Simon McVittie <smcv@collabora.com>
This makes it a bit easier to override both temporary directories used
for sockets to the same place. If a directory is suitable for production
use for the session bus' temporary sockets, the same directory is very
likely to be suitable for build-time tests as well, and using that
directory for both purposes makes the tests more realistic.
The non-default CMake build system already did the equivalent of this:
it doesn't have an equivalent of test_socket_dir, and setting its
equivalent of session_socket_dir affects both.
Signed-off-by: Simon McVittie <smcv@collabora.com>
This makes it a little bit clearer that it's OK for the default value
to be Unix-specific. The CMake build system already has the equivalent
of this.
Signed-off-by: Simon McVittie <smcv@collabora.com>
This is not used on Windows (in fact it's only used in the
dbus-cleanup-sockets(1) tool) so it's OK for it to have a value like /tmp
that would be inappropriate on Windows. Make that more obvious.
Signed-off-by: Simon McVittie <smcv@collabora.com>
This makes it more obvious that it is currently only used on Unix,
and therefore it's OK for it to have a default that wouldn't work
on Windows.
The non-default CMake build system already didn't set the variable when
building for Windows.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Meson build-time tests are run with `meson test` instead, but let's
say "automated tests" generically, rather than a specific command.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Commit 54d26df5 "config: change default auth_timeout to 5 seconds"
reduced the hard-coded default from 30 to 5 seconds, and the
commented-out informational copy of this information in system.conf
reflected that.
Commit 02e1ddf9 'Revert "config: change default auth_timeout to 5 seconds"'
subsequently increased hard-coded default back to 30 seconds, but did
not update the commented-out version in this file.
See also CVE-2014-3639, fd.o #80919, fd.o #86431.
Fixes: 1a36f983 "Document default limits in system.conf.in"
Fixes: 02e1ddf9 'Revert "config: change default auth_timeout to 5 seconds"'
Signed-off-by: Simon McVittie <smcv@collabora.com>
We recommend the Meson build system for all target operating systems
other than Windows. We do try to keep CMake builds operational on Linux
to make life easier for developers, but the `opensuse cmake debug` job,
which runs by default, is sufficient for that.
Signed-off-by: Simon McVittie <smcv@collabora.com>
This was broken for a while (see dbus#462, dbus!426, dbus!429, dbus!512)
but now it works again. Let's not allow it to regress without someone
noticing.
Signed-off-by: Simon McVittie <smcv@collabora.com>
If we're building a dependency as a fallback subproject, we don't want
to be responsible for installing it as a shared library. Anyone wanting
shared libraries should install the dependencies separately.
Ideally we'd do this with MSVC too, but that doesn't currently link
successfully (dbus#549).
Signed-off-by: Simon McVittie <smcv@collabora.com>
If we're falling back to building a local copy of expat, running or
debugging its unit tests is out-of-scope for maintenance of dbus.
In fact this is the default in the meson_options.txt provided by
WrapDB[1], but explicit is better than implicit.
[1] https://github.com/mesonbuild/wrapdb/blob/HEAD/subprojects/packagefiles/expat/meson_options.txt
Signed-off-by: Simon McVittie <smcv@collabora.com>
Some of them fail when run on Windows, and debugging the test suite
for a subproject is out-of-scope for dbus.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Updated with:
meson wrap update
We need a newer GLib when building on Windows using Meson, because the
removal of distutils in recent versions of Python breaks older GLib.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Debian 12 'bookworm' has Meson 1.0.1, which is too old for the current
stable branch of GLib. Use the version from bookworm-backports when
running on Debian and building with a mingw-w64 compiler.
We can stop doing this and put meson back in the normal list of
packages when we update to the Debian 13 stable release, expected to be
released in mid 2025.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Updated with:
meson wrap update
expat 2.6.4 contains security fixes. In practice these don't affect
dbus, because we only use expat to parse trusted message bus
configuration, but we might as well use the newest available version.
Signed-off-by: Simon McVittie <smcv@collabora.com>
FreeBSD 13.1 has been EOL since July 2023, but because there are
apparently no FreeBSD users among the dbus maintainers, nobody noticed.
dbus/dbus#308 is still present in FreeBSD 14.2, so remove the version
check when skipping that particular test.
Signed-off-by: Simon McVittie <smcv@collabora.com>
The image contains build-dependencies from tools/ci-install.sh, so it
can be different for 1.16.x vs. main. Include the upstream branch name
in the tag name, like we already did for the Windows image, so that
an image with the same timestamp but different content can be different.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Commit a56de468 "CI: Avoid using a no-op download location that gives
a 403 error" changed this, but now the direct URL to the file *also*
gives a 403 error. According to the comments in this file, the only
reason we're fetching these URLs is in an effort to pre-seed the
cache of intermediate certificates, so the specific URL that we're
requesting is uninteresting: we just need to fetch *something*.
dbus#546
Signed-off-by: Simon McVittie <smcv@collabora.com>
libselinux 3.8 includes an API break in which the `refcnt` field of
struct security_id_t (originally intended to be a reference count, but
in practice always initialized to 1 and never modified) was renamed and
repurposed as an `id` field. This caused a build failure if dbus was
compiled with both SELinux support and verbose mode, for example in the
instrumented debug build that Debian includes in the `dbus-tests` package.
This particular piece of debug logging has little value, so just
remove it.
Reference: e5fd7b078f
Bug-Debian: https://bugs.debian.org/1096212
Signed-off-by: Simon McVittie <smcv@collabora.com>