Commit graph

6580 commits

Author SHA1 Message Date
Alex Richardson
c5686f0c24 DBusMessageIter: ensure contiguous layout with 128-bit pointers
I am building DBus targeting the Arm Morello board and the "no padding"
layout assertion fails here since pointers require 16-byte alignment, and
therefore we have to add two additional ints to the DBusMessageIter struct.
As this is a new architecture, where DBus previously failed to compiled
we do not have any layout backwards compatibility requirements, so we can
simplify the DBusMessageIter structure to allocate space for 16 pointers
(which should give us a lot of space for any further changes).
2022-09-21 11:35:05 +00:00
Alex Richardson
6933a9263e dbus-message.c: skip 1.10 layout compatibility test on new architectures
These static assertions fail on CHERI-enabled architectures such as Arm
Morello, where pointers are 128 bits. Architectures with 128-bit pointers
were not supported in DBus 1.10, so we can skip the checks for DBus 1.10
structure layout compatibility for architectures with pointer size > 64 bit.
2022-09-21 11:35:05 +00:00
Alex Richardson
91f4ac9cf6 dbus-marshal-recursive.h: reduce padding in DBusType{Reader,Writer}
When building for Arm Morello (where pointers are 16 bytes), I hit the
static assertion that sizeof (DBusMessageRealIter) <= sizeof (DBusMessageIter)
inside _dbus_message_iter_init_common() otherwise. This can be fixed by
moving the pointers to the beginning of the struct to remove padding.
2022-09-21 11:35:05 +00:00
Alex Richardson
33dbeb5ebe dbus-mempool.c: ensure that all alignments are aligned to max_align_t
This is required e.g. for CHERI-enabled targets such as Arm Morello where
aligning to sizeof(long) is not sufficient to load/store pointers (which
need 16 byte alignment instead of 8 bytes).

As we can't depend on C11 yet, this commit adds a max_align_t emulation
to dbus-internals.h.
2022-09-21 11:35:05 +00:00
Alex Richardson
c4a8c2d920 dbus-mempool.c: use size_t for variables holding object sizes 2022-09-21 11:35:05 +00:00
Alex Richardson
464b51acde dbus-internals: use size_t in _DBUS_ALIGN_VALUE()
When targeting CHERI-enabled architectures such as Arm Morello, performing
a bitwise and with uintptr_t values can result in an ambiguous operation
compiler warning. Fix this warning by telling  compiler which operand is
(potentially) a pointer and which one is an integer by changing the
boundary type to size_t. This change has no functional effect on other
architectures but is required to build with -Werror for Morello.

Example warning message:
```
warning: binary expression on capability types 'unsigned __intcap' and 'unsigned __intcap'; it is not clear which should be used as the source of provenance; currently provenance is inherited from the left-hand side [-Wcheri-provenance]
  _dbus_assert (_DBUS_ALIGN_VALUE (insert_at, 8) == (unsigned) insert_at);
```
2022-09-21 11:35:05 +00:00
Alex Richardson
8c0d9709f3 clang-format: don't align escaped newlines in macro definitions 2022-09-21 11:35:05 +00:00
Alex Richardson
e2f3f0123c clang-format: add spaces before parens
Previously, clang-format was not adding a space after sizeof.
2022-09-21 11:35:05 +00:00
Simon McVittie
a225a9c41a Merge branch 'fix-freebsd-ci' into 'master'
gitlab-ci: update FreeBSD CI image to 13.1

See merge request dbus/dbus!347
2022-09-21 11:31:43 +00:00
Alex Richardson
93203e9524 gitlab-ci: update FreeBSD CI image to 13.1
FreeBSD 13.0 has reached EOL and it appears packages
are built against a newer baseline now, so we end up
with missing symbol errors:
ld-elf.so.1: /lib/libc.so.7: version FBSD_1.7 required by /usr/local/lib/libpython3.9.so.1.0 not found

It also appears that the fdpass test still fails on 13.1, so update the
condition to less than 14.0
2022-09-21 09:01:56 +00:00
Simon McVittie
546617d23c Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-19 10:45:01 +01:00
Simon McVittie
1c53a181ee Merge branch 'test-socket-dir' into 'master'
test: Use DBUS_TEST_SOCKET_DIR to create the test socket

See merge request dbus/dbus!334
2022-09-15 19:13:21 +00:00
Alex Richardson
e1ff3c09d7 test: Use DBUS_TEST_SOCKET_DIR to create the test socket
I am trying to run cross-compiled tests in QEMU with the build directory
mounted via smbfs, and therefore creating the sockets in the CWD does not
work. Using DBUS_TEST_SOCKET_DIR (/tmp by default) allows me to run the
tests successfully.
2022-09-15 18:58:20 +00:00
Alex Richardson
3b605a5a6d cmake: define DBUS_TEST_SOCKET_DIR in the config header
This matches autotools.
2022-09-15 18:22:49 +00:00
Alex Richardson
feff0333d5 meson: define DBUS_TEST_SOCKET_DIR in the config header
This matches autotools
2022-09-15 18:22:49 +00:00
Simon McVittie
6c9b4846b9 Merge branch 'mempool-flex-array-followup' into 'master'
mempool: Require C99 flexible arrays

See merge request dbus/dbus!344
2022-09-15 17:02:35 +00:00
Simon McVittie
57c9f99d78 mempool: Require C99 flexible arrays
dbus 1.15.x officially requires C99, so we can do this unconditionally
on the 1.15.x branch.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-15 16:46:59 +00:00
Simon McVittie
e2f7256bbe Merge branch 'mempool-flex-array' into 'master'
dbus-mempool: Use flexible or zero-length arrays if possible

See merge request dbus/dbus!343
2022-09-15 16:46:46 +00:00
Simon McVittie
374087124c dbus-mempool: Use flexible or zero-length arrays if possible
If the elements field has a fixed nonzero size, accessing elements
beyond that size is technically undefined behaviour, which is caught
by some options of the undefined behaviour sanitizer. Try to use a C99
flexible array, or failing that, a zero-length array (which is a popular
non-standard syntax to achieve the same thing).

dbus 1.15.x has C99 as a requirement, but this commit avoids assuming
C99 in order to make this change backportable to 1.14.x if it becomes
necessary to do so (for example to be able to run tests or fuzzers
against 1.14.x, or if compilers' defaults become more strict).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-15 15:26:58 +01:00
Simon McVittie
2ea6bdcab8 Update NEWS for 1.15.x branch
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-12 21:45:50 +01:00
Simon McVittie
9127b8ffa5 Merge branch 'msys2-packages' into 'master'
CI: Don't pin msys2 packages to a specific version at all

See merge request dbus/dbus!338
2022-09-12 19:19:49 +00:00
Simon McVittie
bb38fb361e CI: Don't pin msys2 packages to a specific version at all
Similar to dbus/dbus!286, but more so: just use the package names,
ignoring their version numbers completely.

pcre2 is not strictly needed at the moment, but it'll be a dependency
for GLib >= 2.73.x (older versions used pcre). For a bit of
future-proofing, download both pcre and pcre2.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-12 20:01:50 +01:00
Simon McVittie
9f9a01b1da Merge branch 'windows-no-tap' into 'master'
TAP-related workarounds in Meson build system

Closes #414

See merge request dbus/dbus!340
2022-09-12 19:00:27 +00:00
Simon McVittie
52a8adf901 test: Don't use strict TAP parsing on Windows
Debug messages in a background thread can corrupt the machine-readable
TAP output, and in particular GWin32AppInfo emits debug messages from
a background thread when we link to libgio.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/414
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-12 19:36:16 +01:00
Simon McVittie
c9d0f7968f build: Only work around Meson 0.63.0 bugs for version 0.63.0
mesonbuild/meson#10577 was fixed in 0.63.1.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-12 19:23:54 +01:00
Simon McVittie
031c2b1332 Merge branch 'fix/412' into 'master'
_dbus_message_iter_append_check: Fix ifdef check

Closes #412

See merge request dbus/dbus!336
2022-08-18 13:25:16 +00:00
Johannes Kauffmann
eb195d70d0 _dbus_message_iter_append_check: Fix ifdef check
With internal DBus checks disabled, but with assertions enabled, the
function would be ifdef'ed out. This is problematic, since the function
is called from within an assertion statement in _dbus_variant_write().

Fixes #412.

Co-authored-by: Simon McVittie <smcv@collabora.com>
2022-08-18 12:34:24 +00:00
Simon McVittie
7e0c51d800 Merge branch 'add-freebsd-ci' into 'master'
Add a FreeBSD CI job

See merge request dbus/dbus!280
2022-08-10 11:33:11 +00:00
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