Commit graph

6552 commits

Author SHA1 Message Date
Alex Richardson
468cc3e8ba Update NEWS to mention FreeBSD CI 2022-08-10 11:18:20 +00:00
Alex Richardson
31fd3822c3 Add myself to AUTHORS 2022-08-10 11:18:20 +00:00
Alex Richardson
82d5ee848d gitlab-ci: Add a FreeBSD meson job
Also bump the FDO_DISTRIBUTION_TAG to ensure the disk images
include meson.
2022-08-10 11:18:20 +00:00
Alex Richardson
ee880ef811 tools/ci-install.sh: Install meson build dependencies on FreeBSD
Python is already installed, but we need the python3 package to get the
/usr/local/bin/python3 symlink rather than the one with the version suffix.
2022-08-10 11:18:20 +00:00
Alex Richardson
932b740826 test/fdpass.c: skip test that fails on FreeBSD 13.0
The /odd-limit/at test passes on 13.1 and 14.0 images, but fails on 13.1.
Debugging has not given me any useful hints why this may be the case, so
disable this test on 13.0 for now.

This allows us to drop the ci_test_fatal: "no" override which will ensure
that any FreeBSD regressions are caught.
2022-08-10 11:18:20 +00:00
Alex Richardson
1378e8e37e gitlab-ci: Add a FreeBSD autotools CI job
Now that the underlying issues with FreeBSD autotools CI have been fixed,
we can add a CI job to prevent future regressions.
2022-08-10 11:18:20 +00:00
Alex Richardson
db441d3017 ci-build.sh: Add a autotools ci_variant without the docs archive
This is needed to add autotools support to the FreeBSD CI since we don't
include all the packages needed to build dbus-docs.tar.xz.
2022-08-10 11:18:20 +00:00
Alex Richardson
2659a0f18e gitlab-ci: Use GNU make on FreeBSD
The Makefile.am files contain % pattern rules that are not supported by
`make` (bmake) on FreeBSD. Since the replacing the patterns is non-trivial,
this commit updates the CI script to use GNU make when building on FreeBSD.
2022-08-10 11:18:20 +00:00
Alex Richardson
defbade7b9 gitlab-ci: Don't use sudo for the FreeBSD job
We are already building as root and sudo is not currently installed on
the CI image, so the autotools build fails without this change.
2022-08-10 11:18:20 +00:00
Alex Richardson
902260f6da gitlab-ci: Install pkg-config on FreeBSD
Without this change the autotools build system fails to find glib and
reports an error. The CMake build worked prior to this change since CMake
has fallback logic to find glib even without pkg-config.
2022-08-10 11:18:20 +00:00
Alex Richardson
d67132d3d0 gitlab-ci: Add a FreeBSD CMake CI job
This uses https://gitlab.freedesktop.org/freedesktop/ci-templates,
and runs the FreeBSD build+test inside a QEMU VM.
This depends on the recently merged ci-templates MR
https://gitlab.freedesktop.org/freedesktop/ci-templates/-/merge_requests/142,
so we bump the required ci-templates commit hash.

There is one undiagnosed failure in test-fdpass that needs investigation,
so for now failures are permitted. Autotools and meson jobs will be added
in follow-up commits.
2022-08-10 11:18:20 +00:00
Alex Richardson
a214ed824d dbus-sysdeps-util-unix.c: Avoid including sys/syslimits.h
This header is GCC specific header that on my system just contains
`#include_next <limits.h>`. FreeBSD also provides this header but it
contains a `#warning` that it should not be used. Replace the one use
with `#include <limit.h>` and drop the configure checks.
2022-08-10 11:18:20 +00:00
Alex Richardson
82f5c96644 cmake: Always try to find pkg-config
Commit 97bdefd4e2 move the
include(FindPkgConfig) call into a Linux-specific codepath, so pkg-config
was not being detected on FreeBSD. This mean that the check for
PKG_CONFIG_FOUND to determine whether to install .pc files later on
would always fail and .pc files were not installed on FreeBSD.
2022-08-10 11:18:20 +00:00
Alex Richardson
7ca69a9785 dbus-launch-x11.c: Silence clang -Wcast-align warning
In this case the cast is safe since the manual guarantees that the
underlying storage is an array of `long`.
2022-08-10 11:18:20 +00:00
Alex Richardson
aec2ad7efb test-utils-glibc.c: Fix -Werror,-Wmissing-noreturn on FreeBSD
Add a conditional _DBUS_GNUC_NORETURN to avoid
`error: function 'back_to_root' could be declared with attribute 'noreturn'`
2022-08-10 11:18:20 +00:00
Alex Richardson
cf51eeb555 test-utils-glib.c: Avoid using a non-portable errno value
ENODATA is not available on FreeBSD. Since the actual errno value here
does not matter, use EPERM instead.
This fixes the DBus build on FreeBSD.
2022-08-10 11:18:20 +00:00
Alex Richardson
a7fe9438c4 dbus-sysdeps-unix.c: Fix unused function warning on FreeBSD
The function close_ignore_error() is only used in some cases. To avoid
duplicating the #ifdef condition, this patch moves the check just before
the definition of _dbus_close_all().
2022-08-10 11:18:20 +00:00
Alex Richardson
aa90d09940 tools/ci-build.sh: Ensure that $builddir is set
When adding the new FreeBSD CI, this was not implicitly forwarded to QEMU,
so the build script failed with confusing errors. Add an explicit check
that the variable is set to make those cases easier to debug.
2022-08-10 11:18:20 +00:00
Alex Richardson
ca091e78d3 tools/ci-install.sh: Add FreeBSD support
This adds support for installing the required packages on FreeBSD.
2022-08-10 11:18:20 +00:00
Alex Richardson
295912045e tools/ci-{build,install}.sh: Use a portable interpreter argument
FreeBSD has bash installed as /usr/local/bin/bash, so hardcoding /bin/bash
does not work. Instead use the portable replacement using env which will
find bash in $PATH.
2022-08-10 11:18:20 +00:00
Simon McVittie
17db7f268a Merge branch 'cxx-only-on-windows' into 'master'
meson: Only require C++ compiler when building for Windows

See merge request dbus/dbus!333
2022-08-10 10:38:26 +00:00
Simon McVittie
bc24596886 meson: Only require C++ compiler when building for Windows
dbus is generally a C-only project, but the Windows side has a tiny
amount of C++ to initialize global locks (because Windows doesn't have
a direct equivalent of PTHREAD_MUTEX_INITIALIZER). We don't need a C++
compiler when building for a non-Windows OS, so there's no need to
find it or check which options it supports.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-26 17:08:56 +00:00
Simon McVittie
72d0a79eba NEWS: Update Dependencies section
dbus!332 increased the CMake dependency.

The Meson build system is new, but it seems reasonable to mention the
new (optional) dependencies at top level.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-26 11:37:28 +01:00
Ralf Habacker
697aae005a Merge branch 'cmake-current-source-dir' into 'master'
cmake: Fix top-level directory references when vendored into a larger project

See merge request dbus/dbus!332
2022-07-26 04:31:13 +00:00
Jordan Williams
625366dd0e
Update NEWS 2022-07-25 14:14:57 -05:00
Jordan Williams
e62e42f84c
Add name to AUTHORS 2022-07-25 14:14:57 -05:00
Jordan Williams
fac146f44d
Use project relative paths in CMake files
This makes it possible for projects to incorporate D-Bus as a CMake sub-project in a larger CMake project.
Before this PR, doing so would result in many errors.
This is because CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR would point to directories above the D-Bus project.
Using paths relative to the project directory, PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR, corrects for this.
2022-07-25 14:14:57 -05:00
Jordan Williams
ad5836cb0d
Bump CMake version to 3.4
With the minimum version set to 3.4, none of the policies need to be set explicitly to the `NEW` behavior.
Each of the policies removed here was introduced before CMake version 3.4.
By default then, each of them will be set to NEW automatically.
This is part of the behavior of cmake_minimum_required.
The cmake_policy commands are therefore redundant and have been removed.
2022-07-25 14:14:56 -05:00
Simon McVittie
8e0290fcc8 release-checklist: Add a reminder to update both Autotools and Meson
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-23 11:23:06 +01:00
Simon McVittie
3758e5b164 Move release checklist to its own file
In other projects I've found that having a separate file that only
lists the release steps makes them easier to check.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-23 11:23:06 +01:00
Simon McVittie
702ca4d13c Merge branch 'require-c99' into 'master'
Officially drop support for non-C99 compilers, and start using C99 low-hanging fruit

Closes #404

See merge request dbus/dbus!331
2022-07-20 13:27:46 +00:00
Simon McVittie
98eff5513e build: Assume stdint.h is provided
We now require a (mostly-)C99 compiler, meaning we can rely on having
Standard C stdint.h.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-19 21:11:09 +01:00
Simon McVittie
36038fb126 Remove fallback implementation of strtoll(), strtoull()
We now require a (mostly-)C99 compiler, which guarantees the presence
of these functions.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-19 21:11:09 +01:00
Simon McVittie
624efc0781 cmake: Stop redefining snprintf() to _snprintf() on MSVC
We now require a mostly-C99 compiler like MSVC 2015, which provides
Standard C snprintf().

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-19 20:50:33 +01:00
Simon McVittie
a54ed9ffad Remove emulation of va_copy() in non-C99 compilers
dbus now requires a (mostly-)C99 compiler, which guarantees the presence
of Standard C va_copy().

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-19 20:50:33 +01:00
Simon McVittie
bf30fe6d60 build: Remove support for emulating inline with __inline or __inline__
We now require a (mostly-)C99 compiler, and C99 guarantees the presence
of the inline keyword.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-19 20:45:31 +01:00
Simon McVittie
6d46d43aab NEWS, README.win: Officially drop support for non-C99 compilers
We're considering MSVC 2015 to be sufficiently close to C99 for our
purposes, and we now have CI for it, so we can easily check whether any
desired C99 feature works. Other pre-C99 compilers are obsolete.

Resolves: dbus#404
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-19 20:45:24 +01:00
Simon McVittie
536b39a11c Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-19 20:27:29 +01:00
Simon McVittie
440aa8edf0 Merge branch '30x-faster-testing' into 'master'
tests: Speed up bus-dispatch OOM testing by a factor of 30

See merge request dbus/dbus!328
2022-07-18 13:06:58 +00:00
Simon McVittie
f49ff4f0ea dispatch test: Pass in test data directory as a C string
This reduces duplication a little bit.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-18 11:15:54 +00:00
Simon McVittie
bef88fd562 test/bus: Break up dispatch test into three separate tests
This is really three separate test-cases: one for traditional
activation as a direct child process of the dbus-daemon, and two for
traditional activation (successful and failing) via the setuid
dbus-daemon-launch-helper on Unix.

The ones where activation succeeds extremely slow, as a result of the
instrumentation for simulating malloc() failures combined with a large
number of memory operations, particularly when using AddressSanitizer.

Splitting up "OOM" tests like these has a disproportionately good impact
on the time they take, because the simulated malloc() failure
instrumentation repeats the entire test making the first malloc() fail,
then making the second malloc() fail, and so on. For allocation failures
in the second half of the test, this means we repeat the first half of
the test with no malloc() failures a very large number of times, which
is not a good use of time, because we already tested it successfully.

Even when not using the "OOM" instrumentation, splitting up these tests
lets them run in parallel, which is also a major time saving.

Needless to say, this speeds up testing considerably. On my modern but
unexceptional x86 laptop, in a typical debug build with Meson, the old
dispatch test took just over 21 minutes, which drops to about 40 seconds
each for the new normal-activation and helper-activation tests (and for
most of that time, they're running in parallel, so the wall-clock time
taken for the whole test suite is somewhere around a minute).

In a debug build with Meson, gcc and AddressSanitizer, the old dispatch
test takes longer than my patience will allow, and the new separate
tests take about 5-6 minutes each. Reduce their timeout accordingly, but
not as far as the default for slow tests (5 minutes) to allow some
headroom for AddressSanitizer or slower systems.

The failed-helper-activation test is almost instantaneous, and no longer
needs to be marked as slow.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-18 11:15:54 +00:00
Simon McVittie
11e6c92e95 test/bus: Factor out common setup/teardown code
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-18 11:15:54 +00:00
Simon McVittie
2cdd0d0f30 Merge branch 'uid-0-in-userns' into 'master'
test: Skip tests that involve switching uid if unable to do so

Closes #407

See merge request dbus/dbus!330
2022-07-18 11:15:17 +00:00
Simon McVittie
8b08dd3264 test: Skip tests that involve switching uid if unable to do so
In a Linux user namespace, it is possible that we are uid 0 but are
unable to switch to some other uid like DBUS_USER or DBUS_TEST_USER,
because the other uid is not "mapped" in the user namespace, resulting
in setuid() or setresuid() failing with EINVAL "Invalid argument".
For example, it's easy for this to happen when running under the
bubblewrap tool.

Try to drop privileges in a child process, and skip the test if we
are unable to do so.

Resolves: dbus#407
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-18 10:31:40 +00:00
Simon McVittie
a615db944c Merge branch 'issue-405' into 'master'
Escape socket path when building the D-Bus address

See merge request dbus/dbus!329
2022-07-18 09:27:44 +00:00
Marc-André Lureau
c7a98fd20b Escape socket path when building the D-Bus address
Fixes:
https://gitlab.freedesktop.org/dbus/dbus/-/issues/405

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-18 11:11:11 +04:00
Simon McVittie
a3850d399c Merge branch 'oom-score-adj' into 'master'
Improve dbus-daemon-launch-helper behaviour if it cannot write oom_score_adj

See merge request dbus/dbus!291
2022-07-17 19:01:43 +00:00
Simon McVittie
a8006841ce sysdeps: Only open oom_score_adj read/write if we need to write it
If we're running in a sandbox, we might not have write access to
oom_score_adj. In the common case where we don't have any special
protection from the OOM-killer, we can detect that with only read
access, and skip the part where we open it for writing.

(We would also not have write access to oom_score_adj if we're running
with elevated Linux capabilities while not root, but that should never
actually happen for dbus-daemon-launch-helper, which is setuid root
for production use or has no capabilities during unit-testing.)

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-16 22:23:07 +00:00
Simon McVittie
ad72e3b9e3 activation-helper: Never crash if unable to write oom_score_adj
_dbus_warn() normally only logs a warning, but can be made fatal by
environment variables. In particular, we do that during unit testing,
which can result in a build-time test failure if dbus is built in a
sandbox environment that prevents write access.

_dbus_log() does only the logging part of _dbus_warn(), which seems
more appropriate here.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-16 22:23:07 +00:00
Simon McVittie
b3163746a9 Merge branch 'win32-uds' into 'master'
Add Unix socket support on Windows

See merge request dbus/dbus!249
2022-07-15 16:14:55 +00:00