Commit graph

6477 commits

Author SHA1 Message Date
Marc-André Lureau
519dd8726e dbus: move unix socket declarations to common sysdeps.h
The function declaration can be moved to system-agnostic header and be
implemented on Windows in following commits.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:18 +01:00
Marc-André Lureau
f8343fa397 dbus: change unix socket functions to return DBusSocket
This will allow to abstract away for Windows Unix socket support.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:18 +01:00
Marc-André Lureau
81b49af8a2 dbus: simplify socket close() & invalidate() calls
Now that _dbus_close_socket() invalidates the socket on its own already.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:18 +01:00
Marc-André Lureau
581344c17d dbus: set the socket as invalid in _dbus_close_socket()
This can simplify error handling in many situation where a socket is
returned, such as in the following commits.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:18 +01:00
Marc-André Lureau
7d20a3c604 dbus: make _dbus_close_socket() take DBusSocket*
This will allow to invalidate the socket in the following commit.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:18 +01:00
Marc-André Lureau
c100e6e9e5 dbus/win: fix a code comment about get_tmpdir()
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:18 +01:00
Marc-André Lureau
31f7f7b072 s/PF_UNIX/AF_UNIX
PF_UNIX is an old BSD 4.x relic, and even there they promise that PF_UNIX
is the same as AF_UNIX. (Linux socket(2))

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:17 +01:00
Marc-André Lureau
91c4e9052a Misc style fix
As pointed out by Simon McVittie <smcv@collabora.com>:
https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/249#note_1323102

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:17 +01:00
Simon McVittie
8e858f5b99 Merge branch 'leak-sanitizer' into 'master'
Silence some LeakSanitizer warnings

See merge request dbus/dbus!326
2022-07-15 15:14:35 +00:00
Simon McVittie
5cd05bbb5a dbus-launch-x11: Ignore X11 connection when checking for memory leaks
The X11 connection is opened and never closed. Because dbus-launch
forks and continues to run non-trivial code in a forked child, it is
not clear whether (or where) it would be safe to close it; instead, we
leave it open until process exit, at which point the socket is cleaned
up by the kernel.

Any memory allocated for the X11 connection is only allocated once per
run of dbus-launch, so there's no need to keep track of it, and we can
silence these memory leak warnings as uninteresting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-15 15:59:38 +01:00
Simon McVittie
9490157ef9 test-privserver: Exit if DBusLoop cannot be allocated
Otherwise, we'd just crash when we dereference the null pointer.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-15 13:54:59 +01:00
Simon McVittie
76296a5f0b test-privserver: Move cleanup of DBusLoop into test_service_data_free()
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-15 13:54:58 +01:00
Simon McVittie
68c490b356 test-privserver: Don't leak a copy of the server address
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-15 13:54:42 +01:00
Simon McVittie
c30fc2ad14 Merge branch 'compiler-args' into 'master'
meson: Improve handling of compiler arguments

See merge request dbus/dbus!325
2022-07-15 12:16:59 +00:00
Simon McVittie
ee36404549 meson: Enable more compiler warnings
This provides parity with what we did in Autotools (most of it via
AX_COMPILER_FLAGS_CFLAGS).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-15 12:25:39 +01:00
Simon McVittie
12a8c8a352 meson: Pass project-wide compile arguments to has_header_symbol, etc.
Otherwise, we'll miss symbols that only appear when _GNU_SOURCE is
defined, like environ in Linux unistd.h.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-15 12:25:25 +01:00
Simon McVittie
e5d2e402f9 meson: Comment why we disable certain compiler warnings
This knowledge shouldn't be lost when we delete the Autotools build
system.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-15 12:22:59 +01:00
Simon McVittie
ab01169a20 meson: Build with -fno-common if supported
This turns off a poorly-supported feature of older compilers. Even when
using an older compiler, we want to behave more strictly.

The Autotools build already did this.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-15 12:22:56 +01:00
Simon McVittie
0c4ec2d2e1 meson: Build with -fno-strict-aliasing if supported
We know that dbus is not fully strict-aliasing-compliant. In Autotools
we got this from AX_COMPILER_FLAGS_CFLAGS.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-15 12:22:46 +01:00
Simon McVittie
0b5dc00e78 meson: Set up functionally necessary compiler arguments separately
We have to set up feature-flag options like _GNU_SOURCE before we
do compiler checks like cc.has_header_symbol, otherwise we'll miss
symbols that are guarded by a feature-flag test, like environ in Linux
unistd.h.

However, we don't want to pass flags for extra compiler warnings
when doing these checks, because that can cause false negatives:
in particular, Meson's check programs nearly always trigger -Wunused.
So the warnings need to be in a separate list.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-15 12:22:43 +01:00
Simon McVittie
57e21c0358 test: Work around TAP test regression in Meson 0.63.0
With Meson 0.63.0, detailed output of TAP tests is not logged, and the
test deadlocks if the stderr pipe fills up. I'm hoping this will be fixed
before 0.63.1, but in the meantime we can work around it by falling back
to the 'exitcode' protocol: this means we lose machine-readable detailed
test results, but at least our tests pass.

See https://github.com/mesonbuild/meson/issues/10577 and
https://github.com/mesonbuild/meson/issues/10563 for details of the
Meson regression.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-15 10:10:54 +01:00
Simon McVittie
2d3f48e8c8 build: Distribute update-authors.sh in tarballs
Newer versions of Meson require the script for a run_target() to be
present at configure time, even if the script isn't run.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-15 10:09:57 +01:00
Simon McVittie
a86eba93a7 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-15 10:09:56 +01:00
Simon McVittie
d626c7bc50 Merge branch 'meson' into 'master'
Meson build system (fork of !135)

Closes #325

See merge request dbus/dbus!303
2022-07-14 10:58:22 +00:00
Simon McVittie
822b63fc6f maintainer-upload-docs: Use paths pointing into the source directory
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-14 11:37:48 +01:00
Marc-André Lureau
9e0bfd5e23 CI: take cmake config.h as artifacts
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
4fd2dfdf51 CI: Don't run tests for openSUSE Meson mingw builds for now
They don't find their library dependencies.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
1f8bf48801 CI: Link libexpat statically when using Wine to run tests
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
82ec4cf28f CI: Skip tests that run dbus-daemon when running on Windows
Mitigates: #400
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
7de7b215f6 CI: Explicitly build before running tests
If we don't do this, Meson will build everything that is a direct
dependency of the test executables, but it won't build indirect
dependencies like GLib's gspawn-win32-helper.exe.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
b01bcb34a3 CI: Ensure that subprojects (if used) are on the Wine PATH
If we are not using Meson subprojects, this will have no practical
effect, because the directories won't exist.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
f8500eb8c1 CI: Collect artifacts for Windows builds
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
3e617c4d5c CI: Force use of subprojects for Windows 32-bit build
The Windows image has expat and zlib installed, but they're 64-bit DLLs
which won't link successfully into our 32-bit build.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
b2a143aa7e CI: Collect config.h
This will help to verify that the Meson and Autotools/CMake builds are
equivalent.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
d8160bdcfa CI: Enable Ducktype-based documentation on Debian/Ubuntu
We don't currently know the equivalent of python3-mallard-ducktype on
other OSs like openSUSE, but we know this should work on Debian (it does
when we do Autotools builds).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
d946c02289 CI: Run Meson with -v so we can see compiler command-lines
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
5cd8b3e0a1 CI: Enable modular tests for all Meson-based CI builds
The whole point of these tests is that they're safe to enable because
they don't affect the production binaries.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
00c18a8050 CI: Factor out Wine setup so that it applies equally to Meson
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
4d0341052a CI: Install cross pkg-config on openSUSE
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
0dac45dce2 CI: Explicitly enable wrap dependencies
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
f49791ec99 CI: Tell Meson build where to find the source directory
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
cceffebed3 CI: Implement debug build variant for Meson
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
14bfd498c6 CI: Explicitly disable features that can't work on Windows
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
c21d47836c CI: Add glue to build with mingw-w64 toolchain on Debian
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
da94d0c029 CI: Only use openSUSE mingw*-meson as a replacement for meson setup
These pass a lot of configure arguments taken from RPM macros, which
are only accepted by the meson command if we don't explicitly select
a mode.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
5eee2d552a CI: Verify that Autotools make dist includes everything needed for Meson
This is similar to what we have done for CMake since dbus/dbus!87
(commit 1063bba "CI: Do the CMake native debug build from an Autotools
`make dist`"). Our official source releases are Autotools `make dist`
tarballs, so our CI should assert that such tarballs contain everything
necessary to do a CMake or Meson build, so that downstream distributions
using our tarballs as source can choose their preferred build system.

When the Meson build system is ready to be recommended as more preferred
than Autotools, we can do as GLib did: stop releasing `make dist`
tarballs, and start releasing `meson dist` tarballs instead (which will
change nothing for Meson or CMake users, but Autotools users will have
to run autoreconf or autogen.sh before building).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
600926adce CI: Consistently build in ./build
This will make it easier to capture log files. All our CI builds happen
in an expendable checkout, so we can safely remove and re-create ./build.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
aaf0be63bd CI: Collect all Meson logs, not just the test log
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
be17ca80fe CI: Add repository for word-size-independent mingw stuff
windows:mingw:win64 depends on packages from windows:mingw.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00
Simon McVittie
1e5badb071 CI: Reinstate mingw*-glib2-devel
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-13 20:36:13 +01:00