Commit graph

6988 commits

Author SHA1 Message Date
Ralf Habacker
6740ff8a4a cmake: update minimum required version to 3.10
This fixes a deprecation warning that compatibility with CMake < 3.10
will be removed from a future version of CMake.

Resolves: dbus/dbus#533

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
(cherry picked from commit ca39b3799e)
2024-12-13 10:28:02 +00:00
Ralf Habacker
5c611c9339 cmake: add missing environment variables for running tests
To achieve comparable results with Meson, the test environment should
provide the same set of environment variables when used in the source
code or the test environment.

Resolves: dbus/dbus#541

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
(cherry picked from commit 8a78585514)
2024-12-13 10:27:59 +00:00
Simon McVittie
1a470c60c4 Post-release version bump
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-11 16:21:01 +00:00
Simon McVittie
daf657a6b0 Prepare v1.15.92
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-11 13:27:54 +00:00
Simon McVittie
5d88ad15ea Update NEWS
dbus!501 intentionally not mentioned here, it's a purely internal change.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-11 13:16:10 +00:00
Simon McVittie
ff872f76fb cmake: Use a better bug reference
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 648f4c2c37)
2024-12-11 13:13:34 +00:00
Simon McVittie
2565691762 bus: Update a build system cross-reference
We no longer have an Autotools build system, but Meson sets the same
environment variables that Autotools used to set. CMake does not, yet,
but ideally should.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/538
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 229e48f549)
2024-12-11 13:13:30 +00:00
Mohamed Akram
8e0e949643 sysdeps-unix: Report missing launchd session bus as non-fatal
init_connections_unlocked() is called when connecting to any of the
well-known buses, and it initializes all of the well-known addresses:
session, system and starter. This means that a failure here causes
failure to connect to any one of the well-known buses, even if the
failure is actually only relevant to a different well-known bus.
As such, it should only fail on genuinely fatal errors, for example
an out-of-memory condition. It calls init_session_address() and
indirectly _dbus_lookup_session_address(), which therefore need to
have similar behaviour.

Previously, _dbus_lookup_session_address() would fail with a
fatal error whenever the macOS session bus was not correctly set up,
but that breaks the ability to connect to the system bus on macOS,
even though the system bus is not directly related to the session bus.
Instead, we should report a missing session bus as "not supported",
reserving an unsuccessful result for fatal situations like
out-of-memory. This brings _dbus_lookup_session_address_launchd()
into line with the error behaviour of _dbus_lookup_user_bus().

Closes: #510
(cherry picked from commit 827e952793)
2024-12-11 13:13:17 +00:00
Simon McVittie
51b9fadf20 Update NEWS for 1.16.x
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-10 16:00:26 +00:00
Simon McVittie
7c65efde7a tests: Exercise NSS group lookup before running tests
Similar to #256, NSS plugins might open file descriptors the first time
they look up a system group, and leave them open. To avoid detecting
this as a leak, do one group lookup (which we expect to fail) before
starting testing, so that the fd is already open the first time we
call _dbus_check_fdleaks_enter(), and therefore is not considered to
have been leaked in _dbus_check_fdleaks_leave().

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/540
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 7cbb7b75dd)
2024-12-10 15:43:57 +00:00
Simon McVittie
08d854af69 sysdeps: Don't check for PROC_SUPER_MAGIC if it isn't defined
Debian GNU/Hurd has fstatfs() but not PROC_SUPER_MAGIC.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/539
Bug-Debian: https://bugs.debian.org/1089641
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 5d7b87496f)
2024-12-10 15:43:43 +00:00
Simon McVittie
fd25d0da1a internals: Use negative numbers to indicate no malloc failure simulation
If we set the countdown to simulating a failed allocation to
_DBUS_INT_MAX, then it will decrement every time we allocate memory,
eventually reaching 0 and triggering a simulated malloc failure.
In practice this does not happen during unit testing, because all of
our tests are (intentionally!) short enough that this can't happen,
but it can happen if a build of dbus with embedded tests enabled is
used for the "real" dbus-daemon or a "real" D-Bus service, either
during debugging or unintentionally, as noted on dbus/dbus!493.

We cannot simply special-case `_DBUS_INT_MAX` to never be decremented,
because _dbus_test_oom_handling() relies on the counter being
decremented even while we are not simulating malloc failure, as a way
to count the number of allocations as an upper bound for how long to
set the countdown during subsequent test runs.

Instead, reserve all negative numbers to represent the absence of
malloc failure simulation, while still being able to count allocations
by comparing two different negative numbers.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/535
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 0735c401a7)
2024-12-10 15:43:38 +00:00
Simon McVittie
dcdc638ea4 cmake: Make intrusive (formerly embedded) tests into a separate option
Previously, the CMake build enabled tests by default, and enabled both
modular and intrusive (embedded) tests with a single option. This is
a really bad idea if anyone is using CMake-built binaries in production.

DBUS_BUILD_TESTS now enables only the modular tests, which are safe to
enable in production builds.

A new DBUS_ENABLE_INTRUSIVE_TESTS option enables the intrusive test
instrumentation.

To preserve existing test coverage, explicitly enable the intrusive
tests in most CMake-based Gitlab-CI jobs (Debian native, openSUSE native,
Windows).

In jobs that have a mirrored pair of production/debug builds (openSUSE
and Debian mingw32/mingw64 cmake), instead we leave the production
build as-is and only build full test coverage in the debug build.

Co-authored-by: Philip Withnall <philip@tecnocode.co.uk>
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 41c7570e1e)
2024-12-10 15:43:34 +00:00
Simon McVittie
53bcfe2de1 Rename "embedded tests" to "intrusive tests"
This hopefully helps to get across the point that enabling these tests
adds instrumentation to libdbus and dbus-daemon, with a potentially
significant impact on code size, performance and security.

To avoid a huge diffstat which would be difficult to review, the cpp
macro that is checked by most of the C code is still
DBUS_ENABLE_EMBEDDED_TESTS, which is defined or undefined under exactly
the same conditions as the new DBUS_ENABLE_INTRUSIVE_TESTS.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/537
Co-authored-by: Philip Withnall <philip@tecnocode.co.uk>
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 9c5b5838f5)
2024-12-10 15:43:31 +00:00
Ralf Habacker
d440173062 cmake: In client configuration file get DBus1_xxx variables from cmake target
The DBus1_xxx variables defined in DBusConfig.cmake for Windows builds
are currently hard-coded values and independent of those of the underlying
cmake target.
To avoid this, these values are retrieved from the corresponding cmake
target. In addition, the cmake allows the construction of the resulting
relocatable runtime paths.

(cherry picked from commit 29c2e9141a)
2024-12-10 10:24:10 +00:00
Simon McVittie
9907deedb1 memory: Remove redundant guard around _dbus_decrement_fail_alloc_counter()
This function is already inside `#ifdef DBUS_ENABLE_EMBEDDED_TESTS`
and doesn't need a second layer of the same guard.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 6e61173d64)
2024-12-10 10:24:04 +00:00
Simon McVittie
80eac5c99e release-checklist: Use a more copy-paste'able scp/rsync destination
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 7dc12d17c8)
2024-12-09 17:07:08 +00:00
Simon McVittie
cb7f88f8a9 release-checklist: Give a better reference for deprecation warnings
Commit 4ebb275ab7 disabled deprecation warnings in the Autotools build
system, which we no longer have. Future stable-branches will want to
disable deprecation warnings in Meson instead.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit f651834427)
2024-12-09 17:07:07 +00:00
Simon McVittie
642a22a0bd release-checklist: Fix sequencing
`meson dist` requires the version you intend to release to have been
committed already, and does not create any generated files in the
`${srcdir}` that are intended to be committed to git.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit b97b083f9a)
2024-12-09 17:07:07 +00:00
Petr Malat
2633d6ba96 _dbus_loop_iterate: Fix OOM retry timeout handling
If there is a pending OOM watch and at the same time there is no
timeout, poll is entered with infinite timeout, because infinite
is expressed with a negative number, which is smaller than any
actual timeout.

Introduce min_poll_timeout(), which returns the smaller non-negative
number of the two, or the larger negative number if both numbers
are negative.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/536
Signed-off-by: Petr Malat <oss@malat.biz>
[smcv: adjust whitespace]
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit a6023f49ac)
2024-12-09 17:03:01 +00:00
Simon McVittie
3543d23735 Post-release version bump to 1.15.91
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-06 16:49:59 +00:00
Simon McVittie
b236012740 Prepare 1.15.90
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-06 13:59:21 +00:00
Simon McVittie
841ac5efff Update AUTHORS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-06 13:59:14 +00:00
Simon McVittie
8bb48e6cd0 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-06 13:53:23 +00:00
Simon McVittie
ef4440f8cd Merge branch '1.16-no-containers' into dbus-1.16 2024-12-06 13:43:29 +00:00
Simon McVittie
76a68867f8 Disable deprecation warnings for stable branch
We're not going to replace deprecated functions here, similar to commit
88e0ccb2 in the dbus-1.10 branch.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-06 13:43:04 +00:00
Simon McVittie
a6df11430b Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-11-29 16:24:38 +00:00
Simon McVittie
411add93ce Merge branch 'issue531' into 'master'
build: Check for socket(), socketpair() in -lsocket if necessary

Closes #531

See merge request dbus/dbus!491
2024-11-29 16:11:18 +00:00
Simon McVittie
1c38c6edcd build: Check for socket(), socketpair() in -lsocket if necessary
On older Solaris, these functions exist in -lsocket rather than in the
standard C library. If we can't find them immediately, try again with
-lsocket added to the dependencies.

Later, use network_libs when checking for optional functions like
socketpair(), so that we will detect it correctly. If socketpair() is
not found, dbus compiles successfully without it, but dbus-daemon will
not start because it cannot set up reload signalling.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/531
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-11-29 16:10:31 +00:00
Simon McVittie
dce4191c64 Merge branch 'fix-RANDOM_INDEX-32bit' into 'master'
dbus-hash: Fix RANDOM_INDEX signed-integer-overflow on 32-bit

See merge request dbus/dbus!487
2024-11-29 12:58:03 +00:00
Jami Kettunen
f10e92244a dbus-hash: Fix RANDOM_INDEX signed-integer-overflow on 32-bit
Found by compiling with clang -fsanitize=signed-integer-overflow etc and
running dbus-daemon on armv7.

Signed-off-by: Jami Kettunen <jami.kettunen@protonmail.com>
2024-11-29 12:57:15 +00:00
Simon McVittie
c0d4873704 Completely remove the Containers1 interface
This interface is still not ready for production use. To minimize
confusion, let's remove it from the 1.16.x stable branch. We can have
another try during the 1.17.x cycle, via dbus/dbus!449.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-11-19 13:20:49 +00:00
Simon McVittie
1f5affa322 Merge branch 'no-containers-dir' into 'master'
bus: Don't create /run/dbus/containers if the feature is disabled

See merge request dbus/dbus!488
2024-11-19 11:28:51 +00:00
Simon McVittie
54f9aa554a bus: Don't create /run/dbus/containers if the feature is disabled
The `Containers1` interface is not stable or production-ready, and is
compile-time-optional behind a build option, which in fact currently
cannot be enabled (it intentionally provokes a compiler `#error` if
enabled). If it isn't enabled, this directory won't be useful, so
there's no reason to create it.

As discussed in <https://github.com/systemd/mkosi/issues/3189>, if we
use the `@DBUS_USER@` here, it makes `tmpfiles.d/dbus.conf` dependent
on having created the `@DBUS_USER@` via `sysusers.d` or some
appropriate distro-specific mechanism. This is problematic in distros
that split up the functionality of dbus into several layers, such as
Debian: the `@DBUS_USER@` conceptually belongs to the same layer as
the well-known system bus, but `/etc/machine-id` and
`/var/lib/dbus/machine-id` are also used by the well-known session bus,
which is orthogonal to the system bus; so we want `dbus.conf` to be in a
lower layer than the `@DBUS_USER@`.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-11-18 19:00:26 +00:00
Simon McVittie
08d64b1638 doc, maint: Publishing DTDs requires a MR to xdg-specs
We can no longer upload to specifications.freedesktop.org directly.
Instead, that area of the freedesktop.org web space is updated by
sending merge requests to the xdg/xdg-specs> project.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-11-04 15:49:39 +00:00
Simon McVittie
f4cf1ebb6d release-checklist: We only update the wiki page for new stable branches
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-11-04 15:47:53 +00:00
Simon McVittie
87204d19b8 Merge branch 'doc-devhelp' into 'master'
doc: Fix Devhelp index for reorganization of documentation files

See merge request dbus/dbus!486
2024-10-29 17:50:45 +00:00
Simon McVittie
264b5ab484 doc: Use the top-level index.html as the table of contents for Devhelp
Now that we have this table of contents, we might as well use it.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-10-29 17:49:44 +00:00
Simon McVittie
397f9789e6 doc: Use api/html to link to Doxygen docs in Devhelp index
Now that we're installing the Doxygen documentation in a subdirectory,
the Devhelp index needs to reflect that.

Fixes: 522633b4 "cmake: install api docs in html subdir"
Fixes: f546ddd9 "meson: Install Doxygen docs as api/html/*.html"
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-10-29 17:49:44 +00:00
Simon McVittie
dc89ac01a9 Post-release version bump
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-10-29 17:48:31 +00:00
Simon McVittie
d30794756d Prepare v1.15.12
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-10-29 13:16:08 +00:00
Simon McVittie
7d06ca9473 Regenerate AUTHORS as per maint/release-checklist.md
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-10-29 13:00:23 +00:00
Simon McVittie
90619c3e58 NEWS: Start to summarize what's new in 1.16.x
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-10-28 19:27:27 +00:00
Simon McVittie
955db66c27 Move old NEWS into separate files, one per stable release
The main NEWS file continues to document all changes since 1.12.0,
including the entire 1.13.x/1.14.x series.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-10-28 19:26:19 +00:00
Simon McVittie
78883432b3 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-10-28 16:13:46 +00:00
Simon McVittie
43bdf1e6d7 Merge branch 'large-rlimit-timeout' into 'master'
tests: Only check whether the first 1024 fds are close-on-exec

Closes #527

See merge request dbus/dbus!481
2024-10-28 16:10:52 +00:00
Simon McVittie
6946489326 tests: Only check whether the first 1024 fds are close-on-exec
On recent Linux systems, systemd sets the hard limit on the number of
file descriptors extremely high (about 1e9, compared with about 1e6 in
previous systemd versions or 4096 in the kernel's historical defaults),
and dbus raises its soft limit to match the hard limit. The result of
sysconf(_SC_OPEN_MAX) is based on the fd limit, and iterating linearly
through that many fds takes long enough for activation to time out.

This particular piece of code is just test instrumentation, which aims to
log (possibly fatal) warnings if any file descriptor is not close-on-exec
as it should be. In practice the test suite doesn't use anywhere near
a thousand fds, so it's sufficient to run this check against a much
smaller number of fds.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/527
Bug-Debian: https://bugs.debian.org/1086148
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-10-28 16:10:39 +00:00
Simon McVittie
4e8973398f Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-10-28 13:29:41 +00:00
Simon McVittie
b6a6b83bb5 Merge branch 'misc-test' into 'master'
test: fix cleanup_test_socket_tempdir on Solaris

See merge request dbus/dbus!480
2024-10-18 14:19:40 +00:00
Alan Coopersmith
66170cbb21 test: fix cleanup_test_socket_tempdir on Solaris
Solaris does not allow rmdir() to remove the cwd, so chdir() out of
the tempdir before removing it.

Without this fix, misc-internal reported a failure on Solaris 11.4:
not ok 16 - failed to remove test socket directory /tmp/dbus-test-tduvWc

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-10-18 14:16:26 +00:00