Commit graph

6501 commits

Author SHA1 Message Date
Marc-André Lureau
e6f2eed6f8 spec: try to improve comment about AF_UNIX path
The comment refers to the nul-padding of sockaddr_un member sun_path and
using an addrlen of sizeof(sockaddr_un). There is not much need to
document an old now "broken" behaviour.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:54 +01:00
Marc-André Lureau
df6ab5924c dbus: extract out _dbus_server_new_for_dir()
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:54 +01:00
Marc-André Lureau
85694b5bb3 gitlab: skip failing runtime directory check, add FIXME
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:54 +01:00
Marc-André Lureau
12af359bb2 dbus/win: use SIO_AF_UNIX_GETPEERPID to lookup peer PID
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:54 +01:00
Marc-André Lureau
d08973f6d3 test: enable AF_UNIX server-oom test on !unix
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:54 +01:00
Marc-André Lureau
522cc62e02 test/server-oom: do not hardcode /tmp
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:54 +01:00
Marc-André Lureau
01b293027e test: enable AF_UNIX relay tests on !unix
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:54 +01:00
Marc-André Lureau
03dac62937 test/relay: do not hardcode /tmp on !unix
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:54 +01:00
Marc-André Lureau
2be8c00a1d test: enable AF_UNIX loopback tests on !unix
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:54 +01:00
Marc-André Lureau
c6d6a2c9e6 tests/loopback: do not hardcode /tmp for !unix
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:54 +01:00
Marc-André Lureau
e05ff718a1 test: fix loopback AF_UNIX tests to work on Windows
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:54 +01:00
Marc-André Lureau
b1213e3aee test: enable AF_UNIX corrupt test on !unix
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:54 +01:00
Marc-André Lureau
a19d2e7f09 tests/corrupt: do not hardcode /tmp on !unix
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:54 +01:00
Marc-André Lureau
58992c88bc test: add test_check_af_unix_works()
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:54 +01:00
Marc-André Lureau
95f4cf53fe dbus: add a few directory separator macros
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:54 +01:00
Marc-André Lureau
dcdb992dd2 dbus: move DBUS_IS_DIR_SEPARATOR to dbus-internals.h
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:49 +01:00
Marc-André Lureau
d98c98d1e5 dbus: move AF_UNIX code to server-socket
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:18 +01:00
Marc-André Lureau
ee7c08afaf dbus: handle unix server in a new function
Split _dbus_server_listen_platform_specific() to handle unix listenable
address independently, allowing Windows support in following commit.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:18 +01:00
Marc-André Lureau
a508ab583d dbus: move AF_UNIX code to transport-socket
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:18 +01:00
Marc-André Lureau
d3dd8c5724 dbus: add _dbus_transport_open_unixexec()
Split _dbus_transport_open_unix_socket() to leave the "unixexec:"
handling to the unix-specific unit.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:18 +01:00
Marc-André Lureau
ed838d4169 dbus: handle unix transport in a new common function
Split out the Unix socket handling from open_platform_specific(),
enabling "unix:" connectable addresses on Windows in next patch.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:18 +01:00
Marc-André Lureau
655266f32e dbus: add function for Unix sockets on Windows
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:18 +01:00
Marc-André Lureau
0cf03ce49b dbus: move _DBUS_MAX_SUN_PATH_LENGTH to sysdeps.h
Share the same constant for all systems.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:18 +01:00
Marc-André Lureau
2137f511db build-sys: check for afunix.h
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-15 16:26:18 +01:00
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