Commit graph

547 commits

Author SHA1 Message Date
Alan Coopersmith
4c300d40cd build: add -lsocket -lnsl if needed on illumos and older Solaris
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2025-08-19 12:34:00 +00:00
Simon McVittie
0a3b1f9d11 CI: Never run the test suites of subprojects
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>
2025-02-27 19:27:06 +00:00
Simon McVittie
2537199d44 CI: Install meson from bookworm-backports when using GLib subproject
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>
2025-02-27 19:27:06 +00:00
Simon McVittie
e116a3774a CI: Avoid hard-coding the version of Expat and GLib in use
Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-02-27 19:06:50 +00:00
Simon McVittie
d38940dec3 CI: Build a newer GLib on Windows
GLib 2.70.x has been EOL for years, and is incompatible with newer
versions of Python.

dbus#547

Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-02-27 15:30:27 +00:00
Simon McVittie
f72402ce1e CI: Fetch a different URL on sourceforge.net
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>
2025-02-27 15:12:25 +00:00
Simon McVittie
9affc8a09d tools: Fix a cross-reference to Mesa's master branch
Mesa has renamed its default branch to main.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-12-17 12:29:37 +00:00
Simon McVittie
41c7570e1e 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>
2024-12-10 10:25:51 +00:00
Simon McVittie
9c5b5838f5 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>
2024-12-10 10:25:23 +00:00
Simon McVittie
9d5e78798d CI: Only configure wine as an exe_wrapper if we are going to run tests
This choice of exe_wrapper doesn't appear to work on Debian 12, causing
a build failure while checking that the output of the C++ compiler is
executable.

Another advantage of this is that if we're not running the test suite,
we can do a more traditional cross-build where running host-architecture
executables is impossible, which doubles as a way to prove that this
still works.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-10-01 14:40:26 +01:00
Simon McVittie
129c1c5d00 CI: Install clang with its Recommends
On Debian 12, this is necessary to get libclang-rt-14-dev (which
contains the headers for LeakSanitizer) without hard-coding the clang
major version.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-10-01 14:30:02 +01:00
Simon McVittie
34284edecf CI: Stop working around httpredir.debian.org
All Debian Docker images from the last few years use deb.debian.org,
which is reliable, by default.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-10-01 14:29:50 +01:00
Simon McVittie
a936c7c4d5 dbus-spam: Ensure that payload_len is always initialized
A command like `dbus-test-tool spam --payload=abcde --bytes` could
previously have left the length uninitialized.

Detected by compiling with gcc 14.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-09-25 14:42:15 +01:00
Simon McVittie
06606bd8cd CI: Set language environment variables to safe values
Recent versions of glibc support C.UTF-8 natively, and both Debian and
openSUSE (which we use for our CI) have been patching it into our glibc
versions for several years before that.

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/488
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-12-01 19:10:56 +00:00
Simon McVittie
ed87c10fdc CI: Remove meson-dist and cmake-dist build systems
Before we removed the Autotools build system, these meant: do a
`make dist` with Autotools, then unpack the resulting tarball, and build
it with Meson or CMake (as appropriate). This was important because the
contents of an Autotools `make dist` differed significantly from what's
in git: only the files that were explicitly declared as sources in the
Autotools build system were distributed, and Autotools would also add its
own generated cruft.

Now that we're doing releases with Meson, the official source release
artifact is basically `git archive`, so there's much less need to
distinguish between official source releases and what's in git, and these
variant build systems became simple aliases for meson and cmake.
Remove those aliases from tools/ci-build.sh, and stop using them in
.gitlab-ci.yml.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-12-01 19:00:20 +00:00
Ralf Habacker
79e33f2a3f CI: on openSUSE use cmake from the windows:mingw project instead from devel:tools:building
Since this repo is already used for mingw builds, the additional repo and
associated problems can be avoided.
2023-12-01 17:18:01 +01:00
Ralf Habacker
8ea959b24e Remove autotools related files 2023-09-01 14:05:08 +00:00
Ralf Habacker
ff80051410 Remove autotools support from CI jobs
The 'debian mingw32 autotools debug' job was replaced with a corresponding
meson related job named 'debian mingw32 meson debug' and the remaining
autotools related jobs were removed.

The drop in replacement job for 'debian mingw64 autotools' is
'debian mingw32 meson' and is now build by default.
2023-09-01 14:05:08 +00:00
Alexander Kanavin
4c658af0b8 time: use dbus_int64_t for seconds instead of long
On 32 bit systems long will overflow in 2038, causing complete breakage.
This is confirmed by running dbus's test suite on a 32 bit system
with system time set to 2040 (and configured to use 64 bit time_t of course).

Note that both timespec and timeval are specified with time_t for the
seconds component. This should propagate everywhere where that data is
passed and stored, but previously _dbus_get_monotonic_time() and
_dbus_get_monotonic_time() would truncate it to long.

Also add a function for parsing dbus_int64_t from
files, as existing functions can only handle long.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
2023-08-23 14:42:05 +02:00
Simon McVittie
3e4dd491bb CI: Install systemd system and user units into our ${prefix}
This keeps everything we install from CI separate from a possible
OS-level installation in /usr.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/470
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-15 12:14:57 +00:00
Simon McVittie
4b4aa24919 CI: Run "as-installed" tests with Meson, not just Autotools
Otherwise, we'd lose this test coverage when we remove Autotools.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/436
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-15 12:14:57 +00:00
Simon McVittie
14c1dcd322 meson: Allow sudo meson install, which doesn't set DESTDIR
This is generally not recommended (dbus should usually be installed from
the OS distributor's packages, which should install into a staging
directory using `DESTDIR`), but we'll want to use it in Gitlab-CI.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-15 12:14:57 +00:00
Simon McVittie
3190b488e3 Add SPDX license tags for the MIT (Expat) license, where straightforward
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-14 17:18:04 +00:00
Ralf Habacker
5d1922784c Use Meson for the 'reduced' and 'legacy' build variants
There are some differences between Autotools and Meson here:

- Because we detect native atomic operations differently, we can no
  longer emulate a platform that doesn't have them, such as ARMv4;
  but modern OSs no longer support ARMv4 and all significant hardware
  platforms now have native atomic operations, so this is now less of
  a concern.

- Similarly, we can no longer emulate a platform that doesn't have the
  getrandom() library function, but that function is available in all
  relevant glibc versions (such as CentOS >= 8, Debian >= 10,
  Ubuntu >= 18.04) so testing the fallback path is less of a concern now.

We also no longer try to disable dnotify in the legacy build, but our
dnotify code path was removed in 2013, so --disable-dnotify didn't do
anything anyway.

[Separated from a larger commit on dbus!378 —smcv]

Co-authored-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-14 17:38:17 +01:00
Ralf Habacker
1b10f4f89c tools/ci-build.sh: cleanup setup and usage of ci_builddir
The order and arrangement of the initialization of the build directories
has been improved: the deletion of special directories have been moved to
the associated part, the rest have been merged and there is a default
value if not specified as an environment variable, making it easier to
execute on the command line.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2023-08-07 19:59:16 +02:00
Ralf Habacker
5ddb3b67bf CI: add prefix 'ci_' to env var 'builddir'
This customization simplifies their use, e.g. when outputting the command
line used. Because of FreeBSD, 'awk' is used instead of 'gawk' to make
sure that the tool is available.
2023-08-07 19:49:53 +02:00
Simon McVittie
8d14293458 CI: Make user creation idempotent
adduser --system exits successfully if the user already exists, but
ordinary adduser doesn't.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/468
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-01 18:30:14 +01:00
Ralf Habacker
4e45eb06b1 CI: Fix problem with configuration when cross building with cmake
Due to an adaptation of an rpm macro for cross-compiling with cmake, there
was a problem with the previous method of using the current directory as
the build directory. Instead, the command line options provided by cmake
are now used to define the source and build directories, which provide more
stable behavior.

Fix #455
2023-06-12 21:36:41 +02:00
Simon McVittie
a56de4684b CI: Avoid using a no-op download location that gives a 403 error
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-12 17:48:48 +01:00
Simon McVittie
b1712683ad CI: Make creation of user idempotent
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-12 17:47:25 +01:00
Simon McVittie
a6da40b206 CI: Disable OOM-testing code paths for Meson, matching Autotools and CMake
Repeatedly re-running each test with different malloc() calls failing
is really slow, and in particular this is making
dbus:dbus / marshal-recursive time out on freedesktop.org CI.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-12 15:40:45 +01:00
Simon McVittie
66a4119fb9 CI: Install mingw64-cross-cmake in openSUSE image
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-12 15:40:45 +01:00
Simon McVittie
e271f286e3 CI: Sort lists of openSUSE packages alphabetically
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-12 15:40:45 +01:00
Simon McVittie
7a6e9f5beb CI: Update Windows runners
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-12 15:40:45 +01:00
Ralf Habacker
344a47a41f tools/ci-install.sh: Make sure we always have a messagebus user, even if the dbus package isn't installed
This fixes a CI installation issue with the meson build system on openSUSE
distribution.

Fixes #445
2023-02-21 10:43:28 +01:00
Simon McVittie
25e1512c17 CI: Re-run some tests as root or as non-root, as appropriate
On Gitlab-CI we're always running the overall script as root (and
therefore we'll only enter the code path to re-run as non-root),
but when using these scripts for manual testing they might be run as
non-root to begin with.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-06 13:24:11 +00:00
Simon McVittie
dfa7eede44 CI: Remove vestigial support for re-running tests in a Docker container
Travis CI needed this, but Gitlab-CI always runs our tests in a Docker
container of our choice, so there's never any need to enter another
(and it's not allowed anyway).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-06 13:23:05 +00:00
Simon McVittie
88dd9d5cc7 CI: Don't change ownership of source directory
These CI scripts were originally used on Travis-CI, which starts all
builds as an ordinary user that has the ability to become root via `sudo`.
On Gitlab-CI, we don't need that: we start as uid 0, and can do the
whole CI run like that. This also means we get somewhat better test
coverage, because some of our unit tests benefit from being run as uid 0.

The only test coverage we lose by being uid 0 is that
test_pending_fd_timeout() in test/dbus-daemon.c is skipped, because
uid 0 bypasses the limit that's under test there.
2023-02-06 13:13:04 +00:00
Daniel Wagner
afb5bbaba4 meson: Introduce message_bus and tools command line option
To make the consume libdbus via Meson's subproject use case more useful,
introduce message_bus and tools command line options which control if
the D-Bus daemon and/or the tools are build. The idea here is that
depending projects are interested only in the library.

The strong recommendation is only to build libdbus as static library:

  libdbus_dep = dependency(
    'dbus-1',
    required: get_option('libdbus'),
    fallback: ['dbus', 'libdbus_dep'],
    default_options: [
      'default_library=static',
      'embedded_tests=false',
      'message_bus=false',
      'modular_tests=disabled',
      'tools=false',
    ],
  )

This ensures that any installed D-Bus infrastructure on the target
system is not overwritten.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2023-01-04 09:35:06 +01:00
Ralf Habacker
2dee523608 Add SPDX license marker for the AFL-2.1 OR GPL-2.0-or-later license
The full license texts are not added because they were already
added in a previous commit.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>

see #394
2023-01-04 07:53:44 +00:00
Ralf Habacker
e3a365e7ac tools/cmake-format: Relicense to BSD-3-Clause
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-11-29 13:33:53 +00:00
Simon McVittie
33bc01e1b5 tools: Mark GPL-only files with SPDX license identifier
These files are licensed under the GPL only, without the AFL dual-license
of most of the dbus codebase.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Co-authored-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-11-29 13:33:53 +00:00
Evgeny Vereshchagin
738d8dbe6f ci: get UBSan to fail and print full backtraces
Unlike ASan, by default UBSan prints one-line warnings and keeps going
and it makes it impossible for the CI to catch issues automatically when
it runs the unit tests. With this patch applied the CI should be able to
prevent issues like
https://gitlab.freedesktop.org/smcv/dbus-issue413/-/merge_requests/1#note_1549306
from making it into the repository going forward.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2022-10-13 03:20:31 +00:00
Evgeny Vereshchagin
9803fb09fc ci: build dbus with clang as well
It should make it possible to catch issues like
like https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/357

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2022-10-13 03:20:07 +00:00
Simon McVittie
e5d8d0c19a build: Show a warning if the system bus socket is not interoperable
We would like to start using ${runstatedir}/dbus/system_bus_socket,
so that distributors who make /var/run a symbolic link to /run will
usually get their dbus-daemon listening on /run/dbus/system_bus_socket,
which has some advantages in corner cases, such as when /var is mediated
by an automounter or is unmounted during system shutdown.

Unfortunately, the interoperable path in the D-Bus Specification is
/var/run/dbus/system_bus_socket for historical reasons (D-Bus is older
than /run), and older versions of Slackware are known to have had /run
and /var/run as distinct directories. Do a check during configuration
to catch systems configured like this and show a warning.

When cross-compiling, this assumes that the system where dbus is built
(the build system in Autotools/Meson, or the "host" in CMake terminology)
has its /var/run and /run set up in a way that is compatible with the
system where dbus will run (the host system in Autotools/Meson, or the
"target" in CMake terminology). This is not 100% correct, but seems good
enough for a warning that will hopefully only trigger for misguided OS
distributors.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-11 17:14:11 +01:00
Kai A. Hiller
f1c17c74ac dbus-monitor: Disable automatic message filtering 2022-10-11 10:50:08 +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
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
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