Commit graph

7137 commits

Author SHA1 Message Date
Simon McVittie
25e370ce8f meson: Don't interpolate the result of configure_file() into a format()
configure_file() returns a file object, which was not intended to be a
valid parameter for format() (even though in practice it works the way
we wanted it to), causing newer Meson versions to report deprecation
warnings.

If the version of Meson is new enough, we can use the full_path()
method. Otherwise, we'll have to re-compute the output filename.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 872ce4d29a)
2024-12-16 10:41:31 +00:00
Simon McVittie
7094a4047e meson: Consistently use boolean defaults for boolean options
Meson accepts either booleans or strings as defaults for a boolean
option, but recommends booleans, and raises deprecation warnings for
strings.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit dc56afed59)
2024-12-16 10:41:25 +00:00
Simon McVittie
7d3bc75835 Merge branch 'meson' into 'master'
meson: Fix deprecation warnings

See merge request dbus/dbus!507
2024-12-13 17:39:58 +00:00
Simon McVittie
872ce4d29a meson: Don't interpolate the result of configure_file() into a format()
configure_file() returns a file object, which was not intended to be a
valid parameter for format() (even though in practice it works the way
we wanted it to), causing newer Meson versions to report deprecation
warnings.

If the version of Meson is new enough, we can use the full_path()
method. Otherwise, we'll have to re-compute the output filename.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-13 13:58:01 +00:00
Simon McVittie
dc56afed59 meson: Consistently use boolean defaults for boolean options
Meson accepts either booleans or strings as defaults for a boolean
option, but recommends booleans, and raises deprecation warnings for
strings.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-13 13:58:01 +00:00
Simon McVittie
b95f7aab26 CI: Use Debian 12 as default container
I don't think we use this for anything any more, because all build
targets run in some more specific container; but just in case it's
used, we should select the current stable release of Debian and not a
previous, EOL version.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 431c78b5fb)
2024-12-13 11:18:27 +00:00
Simon McVittie
3e4a52743e Merge branch 'ci' into 'master'
CI: Use Debian 12 as default container

See merge request dbus/dbus!508
2024-12-13 11:17:30 +00:00
Simon McVittie
431c78b5fb CI: Use Debian 12 as default container
I don't think we use this for anything any more, because all build
targets run in some more specific container; but just in case it's
used, we should select the current stable release of Debian and not a
previous, EOL version.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-13 11:00:15 +00:00
Simon McVittie
510eca1433 Merge branch 'dbus-1.16' 2024-12-13 10:32:08 +00:00
Simon McVittie
c0adbe9f9c Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-13 10:32:02 +00:00
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
f455ba12d6 Merge branch 'fix-issue-533' into 'master'
cmake: update minimum required version to 3.10

Closes #533

See merge request dbus/dbus!506
2024-12-13 10:26:40 +00:00
Ralf Habacker
ca39b3799e 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>
2024-12-12 22:03:54 +01:00
Simon McVittie
e6b77c3454 Merge branch 'fix-issue-541' into 'master'
cmake: add missing environment variables for running tests

Closes #541

See merge request dbus/dbus!505
2024-12-12 15:52:20 +00:00
Ralf Habacker
8a78585514 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>
2024-12-12 16:34:08 +01:00
Simon McVittie
ba0722719c Merge branch 'dbus-1.16' 2024-12-11 16:21:26 +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
dfadf1b68c Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-11 13:19:40 +00:00
Simon McVittie
08cc615c26 Merge branch 'dbus-1.16' 2024-12-11 13:16:16 +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
648f4c2c37 cmake: Use a better bug reference
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-11 13:02:57 +00:00
Simon McVittie
c45d2992b8 Merge branch 'issue538' into 'master'
bus: Update a build system cross-reference

Closes #538

See merge request dbus/dbus!501
2024-12-11 12:51:55 +00:00
Simon McVittie
229e48f549 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>
2024-12-11 12:50:32 +00:00
Simon McVittie
12265328a6 Merge branch 'diagnose-leaked-fd' into 'master'
_dbus_check_fdleaks_leave: Try to describe what the leaked fd is

See merge request dbus/dbus!503
2024-12-11 12:50:14 +00:00
Simon McVittie
3a37279e32 _dbus_check_fdleaks_leave: Try to describe what the leaked fd is
Similar to ebf487ef, but in a different situation.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-11 12:48:37 +00:00
Simon McVittie
c0f0516662 Merge branch 'fix-macos-system-bus' into 'master'
sysdeps-unix: Report missing launchd session bus as non-fatal

Closes #510

See merge request dbus/dbus!461
2024-12-10 16:53:11 +00:00
Mohamed Akram
827e952793 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
2024-12-10 16:52:25 +00:00
Simon McVittie
b407eba60d Start NEWS for 1.17.x
For now, the changes that have happened in parallel on the 1.16.x branch
are listed under 1.15.91.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-10 16:06:21 +00:00
Simon McVittie
8890a5cd69 Merge branch 'dbus-1.16' 2024-12-10 16:05:20 +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
Simon McVittie
9976d957db Merge branch 'issue540' into 'master'
tests: Exercise NSS group lookup before running tests

Closes #540

See merge request dbus/dbus!504
2024-12-10 14:58:02 +00:00
Simon McVittie
7cbb7b75dd 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>
2024-12-10 14:57:13 +00:00
Simon McVittie
e3c3cd6889 Merge branch 'issue530' into 'master'
build: Allow version number to be followed by "-" and a suffix

See merge request dbus/dbus!494
2024-12-10 12:30:37 +00:00
Simon McVittie
c4ec854e64 build: Bump version number to 1.16.99-alpha
This is a placeholder for the first release in the 1.17.x branch, which
is not yet ready, but is intended to be labelled as 1.17.0-alpha when
it is released.

Helps: dbus#530
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-10 12:30:16 +00:00
Simon McVittie
cd667b9556 build: Allow version number to be followed by "-" and a suffix
Some distributions are known to have shipped dbus 1.15.x as though it
was a stable release, and it isn't clear whether they knew that we use
the odd/even versioning convention like GLib does.

If we add a -alpha, -beta, -rc suffix to development versions starting
from 1.17.0, then distros that know we use odd/even versioning will
know that our development versions are not a stable-branch, and so will
distros that mistakenly think we use the "semantic versioning"
versioning convention popularized by <https://semver.org/>.

(We intentionally do not use semver, because semver would require us to
ship a new minor version every time we add new API, and we do not have
the resources to provide security support for an unlimited number of
minor versions in parallel: we need to be able to nominate a subset of
our releases as having longer-term security support, in a way that signals
to distros that these are the releases they should prefer to ship.)

CMake's `project()` doesn't allow this version number format[1], but
we intend to use version numbers where the (major, minor, micro) tuple
is enough to uniquely identify a release, so we can just tell CMake our
version number without the suffix and there will be no ambiguity.

Similarly, the dash is not allowed in GNU ld version scripts, so use
the form of the version number without the suffix there.

[1] https://gitlab.kitware.com/cmake/cmake/-/issues/16716

Helps: dbus#530
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-10 12:30:16 +00:00
Simon McVittie
9a2ccd09c0 Merge branch 'hurd' into 'master'
sysdeps: Don't check for PROC_SUPER_MAGIC if it isn't defined

Closes #539

See merge request dbus/dbus!500
2024-12-10 11:30:05 +00:00
Simon McVittie
5d7b87496f 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>
2024-12-10 11:29:46 +00:00
Simon McVittie
85ae05c422 Merge branch 'issue535' into 'master'
internals: Use negative numbers to indicate no malloc failure simulation

Closes #535

See merge request dbus/dbus!496
2024-12-10 11:28:49 +00:00
Simon McVittie
0735c401a7 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>
2024-12-10 11:10:39 +00:00
Simon McVittie
d928aaf2c6 Merge branch 'intrusive' into 'master'
Rename "embedded tests" to "intrusive tests"

Closes #537

See merge request dbus/dbus!495
2024-12-10 11:09:26 +00:00