]> git.ipfire.org Git - thirdparty/dbus.git/log
thirdparty/dbus.git
3 years agoMerge branch 'fix-cmake-dbus-use-sync' into 'master'
Simon McVittie [Mon, 16 May 2022 18:52:16 +0000 (18:52 +0000)] 
Merge branch 'fix-cmake-dbus-use-sync' into 'master'

cmake: Fix definition of DBUS_USE_SYNC

See merge request dbus/dbus!306

3 years agocmake: Fix definition of DBUS_USE_SYNC
Alex Richardson [Sun, 15 May 2022 10:28:51 +0000 (11:28 +0100)] 
cmake: Fix definition of DBUS_USE_SYNC

dbus-sysdeps-unix.c checks for DBUS_USE_SYNC using 0/1 checks not defined
checks, so we should be using #cmakedefine01. This fixes lots of -Wundef
warnings when compiling for FreeBSD and ensures that we actually use
atomics instead of the pthread fallback there.

3 years agoMerge branch 'fix-wshadow' into 'master'
Simon McVittie [Mon, 16 May 2022 18:36:38 +0000 (18:36 +0000)] 
Merge branch 'fix-wshadow' into 'master'

dir-watch-kqueue: Silence -Wshadow warning

See merge request dbus/dbus!307

3 years agodir-watch-kqueue: Silence -Wshadow warning
Alex Richardson [Sun, 15 May 2022 10:34:48 +0000 (11:34 +0100)] 
dir-watch-kqueue: Silence -Wshadow warning

This should be the last warning that is preventing us from using -Werror
for FreeBSD builds.

3 years agoMerge branch 'ci-templates' into 'master'
Ralf Habacker [Mon, 9 May 2022 12:29:47 +0000 (12:29 +0000)] 
Merge branch 'ci-templates' into 'master'

Use freedesktop/ci-templates for the GitLab CI

See merge request dbus/dbus!301

3 years agoUse freedesktop/ci-templates for the GitLab CI
Alex Richardson [Mon, 18 Apr 2022 22:18:41 +0000 (22:18 +0000)] 
Use freedesktop/ci-templates for the GitLab CI

The CI templates include infrastructure to create docker images with all
packages specified in tools/ci-install.sh. Using those docker images
speeds up the CI since we don't have to install all the dependencies in
every pipeline. We could extend this to also create containers that have
mingw pre-installed but for now we only create an image with the
dependencies that are required for every job.

3 years agoMerge branch 'fix-issue-369' into 'master'
Simon McVittie [Thu, 5 May 2022 14:20:39 +0000 (14:20 +0000)] 
Merge branch 'fix-issue-369' into 'master'

Add assertions to the [c|r]mutex related functions on Windows

Closes #369

See merge request dbus/dbus!243

3 years agoAdd doc to platform related [c|r]mutex functions
Ralf Habacker [Sun, 1 May 2022 17:54:06 +0000 (19:54 +0200)] 
Add doc to platform related [c|r]mutex functions

3 years agoAdd unit tests for platform-specific mutex implementation.
Ralf Habacker [Wed, 2 Mar 2022 12:17:10 +0000 (13:17 +0100)] 
Add unit tests for platform-specific mutex implementation.

The tests are enabled with the embedded tests; the required
low-level functions from the dbus library are decorated with
DBUS_EMBEDDED_TESTS_EXPORT to indicate the appropriate usage.

On Windows, all tests are run; on unix-like operating systems,
individual tests are disabled:
- the tests on #NULL pointers of type DBus[C|R]Mutex, since they
  point to a data structure and would cause a segment violation
  when accessed.
- the multiple lock test for type DBusCMutex, since it would block
  the current thread.

Since the whole point of "rmutex" is to be able to lock multiple
times, the "rmutex double lock" test is enabled on unix-like
operating systems too.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agoAdd assertions to the [c|r]mutex related functions on Windows
Ralf Habacker [Mon, 20 Dec 2021 10:52:45 +0000 (11:52 +0100)] 
Add assertions to the [c|r]mutex related functions on Windows

This detects some error conditions that can only occur as a
result of a programming error, such as attempting to unlock a
mutex that is not locked.

Fixes #369

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agoMerge branch 'fix-strict-warning-related' into 'master'
Ralf Habacker [Sun, 1 May 2022 16:41:06 +0000 (16:41 +0000)] 
Merge branch 'fix-strict-warning-related' into 'master'

Fix mingw gcc 10.3 compiler warnings

Closes #383

See merge request dbus/dbus!275

3 years agotests: Fix build warning "dereferencing type-punned pointer will break strict-aliasin...
Ralf Habacker [Thu, 7 Apr 2022 10:34:00 +0000 (12:34 +0200)] 
tests: Fix build warning "dereferencing type-punned pointer will break strict-aliasing rules"

To avoid that build break in test-marshall-recursive-util.c the newly
added function _dbus_string_append_buffer_as_hex() is used to print
the hex bytes.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agodbus-string: Add _dbus_string_append_buffer_as_hex()
Ralf Habacker [Thu, 7 Apr 2022 10:24:26 +0000 (12:24 +0200)] 
dbus-string: Add _dbus_string_append_buffer_as_hex()

This function provides a portable way to print data as hex values.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
[smcv: Only compile this when needed, improve assertions, coding style]
Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agodbus: Move DBUS_PRIVATE_EXPORT to private header
Simon McVittie [Thu, 21 Apr 2022 13:38:55 +0000 (14:38 +0100)] 
dbus: Move DBUS_PRIVATE_EXPORT to private header

Unlike the rest of the macros in dbus-macros.h, this one would never
have made sense to use in a public header.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agodbus: Move DBUS_ENABLE_EMBEDDED_TESTS to a new dbus-macros-internal.h
Simon McVittie [Thu, 21 Apr 2022 13:35:44 +0000 (14:35 +0100)] 
dbus: Move DBUS_ENABLE_EMBEDDED_TESTS to a new dbus-macros-internal.h

This avoids a circular dependency: I want to use
DBUS_ENABLE_EMBEDDED_TESTS in dbus-string.h, but
DBUS_ENABLE_EMBEDDED_TESTS was previously defined in dbus-internals.h,
which depends on dbus-string.h.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'test-socket-dir' into 'master'
Ralf Habacker [Sun, 1 May 2022 16:28:23 +0000 (16:28 +0000)] 
Merge branch 'test-socket-dir' into 'master'

cmake: Allow overriding TEST_SOCKET_DIR

See merge request dbus/dbus!295

3 years agocmake: Allow overriding TEST_SOCKET_DIR
Alex Richardson [Sat, 16 Apr 2022 15:04:20 +0000 (15:04 +0000)] 
cmake: Allow overriding TEST_SOCKET_DIR

This matches the autotools build where that option can also be overridden.

3 years agoMerge branch 'cmake-user-args' into 'master'
Ralf Habacker [Sun, 1 May 2022 16:10:01 +0000 (16:10 +0000)] 
Merge branch 'cmake-user-args' into 'master'

tools/ci-build.sh: Pass user arguments to cmake last

See merge request dbus/dbus!296

3 years agotools/ci-build.sh: Pass user arguments to cmake last
Alex Richardson [Sun, 20 Mar 2022 00:40:34 +0000 (00:40 +0000)] 
tools/ci-build.sh: Pass user arguments to cmake last

This allows a user to override ENABLE_WERROR for platforms that are not
yet -Werror clean.

3 years agoMerge branch 'fix-c++-warnings' into 'master'
Simon McVittie [Thu, 21 Apr 2022 14:08:44 +0000 (14:08 +0000)] 
Merge branch 'fix-c++-warnings' into 'master'

cmake: fixes for compiler warning support

Closes #387

See merge request dbus/dbus!293

3 years agocmake: Let the c++ compiler use the warnings available to it
Ralf Habacker [Thu, 7 Apr 2022 11:59:21 +0000 (13:59 +0200)] 
cmake: Let the c++ compiler use the warnings available to it

Fixes #387

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agocmake: in macro generate_compiler_warning_flags prevent duplicates in variable contai...
Ralf Habacker [Thu, 7 Apr 2022 11:57:35 +0000 (13:57 +0200)] 
cmake: in macro generate_compiler_warning_flags prevent duplicates in variable containing unsupported warnings

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agocmake: Fix detecting -Wformat-* warnings for gcc
Ralf Habacker [Thu, 7 Apr 2022 11:55:26 +0000 (13:55 +0200)] 
cmake: Fix detecting -Wformat-* warnings for gcc

gcc expects -Wformat to be set along with these type of warnings.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agocmake: Fix not detecting unsupported g++ related warning checks
Ralf Habacker [Thu, 7 Apr 2022 11:53:42 +0000 (13:53 +0200)] 
cmake: Fix not detecting unsupported g++ related warning checks

Unsupported warnings are detected by cmake through errors during
compilation, which causes g++ not to detect them, since they are
only output as warnings. Setting -Werror ensures this.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agoIgnore gcc 10.3 'inline' warnings: 'call is unlikely and code size would grow'
Ralf Habacker [Thu, 7 Apr 2022 12:54:29 +0000 (14:54 +0200)] 
Ignore gcc 10.3 'inline' warnings: 'call is unlikely and code size would grow'

As long as gcc does something with compatible semantics, it is up to gcc
how to optimize our code.

The alternative would be to export the functions in question from the
shared library, which has the disadvantage of greatly increasing the
number of calls across a shared library boundary.

Part-of: https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/275
Reviewed-by: Simon McVittie <smcv@collabora.com>
3 years agobus_service_remove_owner(): Assert that service has an owner
Ralf Habacker [Mon, 7 Mar 2022 15:38:25 +0000 (16:38 +0100)] 
bus_service_remove_owner(): Assert that service has an owner

gcc 10.3 warns that link->data is a possible NULL dereference.
However, that can't actually happen without an earlier programming
error, because bus_service_remove_owner() is only valid to call for
a connection that is currently in the queue to own the service,
in which case we know _bus_service_find_owner_link() will succeed.

Part-of: https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/275
Reviewed-by: Simon McVittie <smcv@collabora.com>
3 years ago_dbus_string_test(): Fix fatal build error caused by "-Wstrict-aliasing"
Ralf Habacker [Tue, 1 Mar 2022 09:54:05 +0000 (10:54 +0100)] 
_dbus_string_test(): Fix fatal build error caused by "-Wstrict-aliasing"

To fix this problem, the problematic code was replaced by a new function
_dbus_string_get_allocated_size(), which uses the existing macro
DBUS_CONST_STRING_PREAMBLE for these purposes.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
Part-of: https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/275
Reviewed-by: Simon McVittie <smcv@collabora.com>
3 years agobus: Add assertions to silence compiler warnings
Ralf Habacker [Tue, 8 Mar 2022 07:48:31 +0000 (08:48 +0100)] 
bus: Add assertions to silence compiler warnings

gcc 10.3 warns that link->data might be NULL, which would make
new_owner->conn a null pointer dereference. However, we know that
we only add valid, non-null BusOwner objects to the list, so that
can't happen in reality.

Part-of: https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/275
Reviewed-by: Simon McVittie <smcv@collabora.com>
3 years agotest-segfault: Fix build error caused by a null pointer dereference warning
Ralf Habacker [Tue, 8 Mar 2022 08:02:51 +0000 (09:02 +0100)] 
test-segfault: Fix build error caused by a null pointer dereference warning

Only do the deliberate crash via undefined behaviour (which the compiler
is quite right to warn us about!) if raise() isn't available.

The pointer needs to be volatile otherwise the compiler is free to remove
the store.

Part-of: https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/275
Reviewed-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'closefrom' into 'master'
Simon McVittie [Thu, 21 Apr 2022 12:18:23 +0000 (12:18 +0000)] 
Merge branch 'closefrom' into 'master'

sysdeps: Use closefrom() or close_range() if available

Closes #278

See merge request dbus/dbus!265

3 years agotest: Add basic test coverage for _dbus_close_all and friends
Simon McVittie [Wed, 2 Mar 2022 13:04:38 +0000 (13:04 +0000)] 
test: Add basic test coverage for _dbus_close_all and friends

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agotest-utils-glib: Add backports of some convenience macros
Simon McVittie [Wed, 2 Mar 2022 13:04:11 +0000 (13:04 +0000)] 
test-utils-glib: Add backports of some convenience macros

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agotest-utils-glib: Ensure correct precedence in g_assert_nonnull()
Simon McVittie [Wed, 2 Mar 2022 13:03:52 +0000 (13:03 +0000)] 
test-utils-glib: Ensure correct precedence in g_assert_nonnull()

It's best-practice to put macro arguments in parentheses so that they
are always treated as a unit.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agosysdeps: On Linux, wrap close_range syscall directly if necessary
Simon McVittie [Wed, 2 Mar 2022 12:25:54 +0000 (12:25 +0000)] 
sysdeps: On Linux, wrap close_range syscall directly if necessary

This was added to the Linux kernel in version 5.9, but the wrapper
wasn't added to glibc until 2.34. Adding our own wrapper for the
system call means we can use close_range() on Debian 11 and
contemporary distributions.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agosysdeps: Include <linux/close_range.h> if available
Simon McVittie [Wed, 2 Mar 2022 13:08:46 +0000 (13:08 +0000)] 
sysdeps: Include <linux/close_range.h> if available

This lets us use CLOSE_RANGE_CLOEXEC whenever the kernel headers
support it, even if glibc doesn't include this header via unistd.h yet.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agosysdeps: Use close_range() if available
Simon McVittie [Tue, 1 Mar 2022 19:33:06 +0000 (19:33 +0000)] 
sysdeps: Use close_range() if available

The version with no flags set, which is a slight generalization of
closefrom(), is available on recent Linux and FreeBSD.

The version with CLOSE_RANGE_CLOEXEC is Linux-specific.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agosysdeps: Only use closefrom() if known to be async-signal-safe
Simon McVittie [Tue, 1 Mar 2022 19:12:38 +0000 (19:12 +0000)] 
sysdeps: Only use closefrom() if known to be async-signal-safe

closefrom() is known to be async-signal-safe on FreeBSD, NetBSD and
OpenBSD, and safe to call after fork() on Solaris, but not necessarily
on DragonflyBSD.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoUse closefrom() to not loop over all possible file descriptors
rim [Fri, 13 Sep 2019 15:58:55 +0000 (15:58 +0000)] 
Use closefrom() to not loop over all possible file descriptors

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/278

3 years agoCI: Add a manual CI job for Ubuntu 22.04 'jammy'
Simon McVittie [Fri, 1 Apr 2022 13:41:37 +0000 (14:41 +0100)] 
CI: Add a manual CI job for Ubuntu 22.04 'jammy'

This has a very recent version of glibc, and in particular is new enough
to have close_range().

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'dont-crash-watch' into 'master'
Simon McVittie [Wed, 20 Apr 2022 11:29:31 +0000 (11:29 +0000)] 
Merge branch 'dont-crash-watch' into 'master'

bus/dir-watch: Do not crash with > 128 dirs

See merge request dbus/dbus!302

3 years agobus/dir-watch: Do not crash with > 128 dirs
Jan Tojnar [Wed, 20 Apr 2022 09:07:25 +0000 (11:07 +0200)] 
bus/dir-watch: Do not crash with > 128 dirs

Without this running, dbus-daemon with long XDG_DATA_DIRS
will crash on out-of-bounds write:

$ XDG_DATA_DIRS=$(seq  -f "/foo/%g" -s ':' 129) dbus-daemon --session
*** stack smashing detected ***: terminated

3 years agoMerge branch 'int64_modifier' into 'master'
Simon McVittie [Tue, 19 Apr 2022 18:47:41 +0000 (18:47 +0000)] 
Merge branch 'int64_modifier' into 'master'

build: Define DBUS_INT64_MODIFIER, analogous to G_GINT64_MODIFIER

See merge request dbus/dbus!289

3 years agobuild: Define DBUS_INT64_MODIFIER, analogous to G_GINT64_MODIFIER
Simon McVittie [Fri, 1 Apr 2022 14:57:07 +0000 (15:57 +0100)] 
build: Define DBUS_INT64_MODIFIER, analogous to G_GINT64_MODIFIER

Using PRId64, etc. to print dbus_int64_t or dbus_uint64_t is not 100%
portable. On platforms where both long and long long are 64-bit (such as
Linux and macOS), we will prefer to define dbus_int64_t as long.
If the operating system has chosen to define int64_t as long long,
which is apparently the case on macOS, then the compiler can warn that
we are passing a long argument to PRId64, which is "lld" and therefore
expects a long long argument (even though that ends up with the same
bit-pattern being used).

We can't necessarily just use int64_t and uint64_t directly, even if all
our supported platforms have them available now, because swapping
dbus_int64_t between long and long long might change C++ name mangling,
causing ABI breaks in third-party libraries if they define C++ functions
that take a dbus_int64_t argument.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'cmake-config-file-unix' into 'master'
Simon McVittie [Tue, 19 Apr 2022 12:06:58 +0000 (12:06 +0000)] 
Merge branch 'cmake-config-file-unix' into 'master'

cmake: Correct DBUS_{SYSTEM,SESSION}_CONFIG_FILE on UNIX systems

See merge request dbus/dbus!297

3 years agocmake: Correct DBUS_{SYSTEM,SESSION}_CONFIG_FILE on UNIX systems
Alex Richardson [Fri, 1 Apr 2022 11:09:45 +0000 (11:09 +0000)] 
cmake: Correct DBUS_{SYSTEM,SESSION}_CONFIG_FILE on UNIX systems

We always install to a dbus-1 subdir, but the path encoded in the binary
was missing the dbus-1/ subdirectory, so we end up getting errors when
trying to load it.

3 years agoMerge branch 'fix-no-x11-build' into 'master'
Simon McVittie [Tue, 19 Apr 2022 11:51:34 +0000 (11:51 +0000)] 
Merge branch 'fix-no-x11-build' into 'master'

Fix no-X11 build after d847b5f6ae994c408c166ed51752ed9f550df600

Closes #392

See merge request dbus/dbus!298

3 years agoFix no-X11 build after d847b5f6ae994c408c166ed51752ed9f550df600
Alex Richardson [Sat, 16 Apr 2022 16:04:22 +0000 (16:04 +0000)] 
Fix no-X11 build after d847b5f6ae994c408c166ed51752ed9f550df600

Since that commit the error variable is used in all cases not only the
DBUS_BUILD_X11 #ifdef branches.

Fixes: https://gitlab.freedesktop.org/dbus/dbus/-/issues/392
3 years agoMerge branch 'ci-auto-detect-distro' into 'master'
Ralf Habacker [Wed, 6 Apr 2022 12:49:44 +0000 (12:49 +0000)] 
Merge branch 'ci-auto-detect-distro' into 'master'

Add automatic detection of distribution and suite to CI scripts

See merge request dbus/dbus!292

3 years agoAdd automatic detection of suite to CI scripts
Ralf Habacker [Mon, 4 Apr 2022 07:22:54 +0000 (09:22 +0200)] 
Add automatic detection of suite to CI scripts

The detection is based on the variable VERSION_CODENAME from
/etc/os-release, which is supported by systemd. For further details see
https://www.freedesktop.org/software/systemd/man/os-release.html.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agoAdd automatic detection of distribution to CI scripts
Ralf Habacker [Wed, 30 Mar 2022 08:50:29 +0000 (10:50 +0200)] 
Add automatic detection of distribution to CI scripts

The detection is based on the variable ID from /etc/os-release,
which is supported by systemd. For further details see
https://www.freedesktop.org/software/systemd/man/os-release.html.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agoMerge branch 'unix-ci-sooner' into 'master'
Simon McVittie [Fri, 1 Apr 2022 16:00:59 +0000 (16:00 +0000)] 
Merge branch 'unix-ci-sooner' into 'master'

CI: Don't wait for Windows Docker image before doing Unix builds

See merge request dbus/dbus!288

3 years agoCI: Don't wait for Windows Docker image before doing Unix builds
Simon McVittie [Fri, 1 Apr 2022 13:47:27 +0000 (14:47 +0100)] 
CI: Don't wait for Windows Docker image before doing Unix builds

The default in Gitlab-CI is that each job waits for all jobs in
previous stages to complete, but we can override this default by
explicitly saying that there are no prerequisites.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'fix-macosx-launchd-build' into 'master'
Simon McVittie [Fri, 1 Apr 2022 13:56:24 +0000 (13:56 +0000)] 
Merge branch 'fix-macosx-launchd-build' into 'master'

Fix building on Mac OSX when using launchd

See merge request dbus/dbus!287

3 years agoFix building on Mac OSX when using launchd
Ralf Habacker [Thu, 31 Mar 2022 06:57:08 +0000 (08:57 +0200)] 
Fix building on Mac OSX when using launchd

Provided by Dawid Wróbel at
https://invent.kde.org/packaging/craft-blueprints-kde\
/-/blob/master/libs/dbus/0002-fix-macos-build.diff

3 years agoMerge branch 'wip/find-arch-include-dir' into 'master'
Ralf Habacker [Wed, 30 Mar 2022 08:16:59 +0000 (08:16 +0000)] 
Merge branch 'wip/find-arch-include-dir' into 'master'

cmake: Look for dbus-arch-deps.h next to DBus1Config.cmake

Closes #314

See merge request dbus/dbus!191

3 years agocmake: Look for dbus-arch-deps.h next to DBus1Config.cmake
Simon McVittie [Fri, 6 Nov 2020 14:42:19 +0000 (14:42 +0000)] 
cmake: Look for dbus-arch-deps.h next to DBus1Config.cmake

<dbus/dbus-arch-deps.h> is architecture-dependent, and compilers have
not traditionally supported an installation path for architecture-specific
headers (Debian-based systems have /usr/include/${multiarch_tuple}, but
that isn't portable beyond Debian). When dbus was built using Autotools,
dependent projects that use CMake need to look for this header in the
right place.

Unfortunately, it seems that at least recent versions of CMake will
ignore the HINTS we get from pkg-config if they are told to search in
a non-standard prefix via ${DBus1_ROOT}.

Look for dbus-arch-deps.h in a directory derived from the filename of
the CMake config file, before trying the normal search algorithm. The
CMake config file is in ${libdir}, and so is the architecture-specific
header, so this should work reasonably reliably.

According to the CMake documentation, if we search for the same thing
multiple times, the first successful result will be used; and searching
with NO_DEFAULT_PATH is the official way to prepend things to the
search order.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/314
Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'generalize-autolaunch' into 'master'
Simon McVittie [Tue, 29 Mar 2022 19:12:02 +0000 (19:12 +0000)] 
Merge branch 'generalize-autolaunch' into 'master'

dbus-launch: Generalize support for discovering an existing bus

Closes #385

See merge request dbus/dbus!273

3 years agodbus-launch: If no X11, look for existing bus before failing
Simon McVittie [Wed, 16 Mar 2022 13:30:33 +0000 (13:30 +0000)] 
dbus-launch: If no X11, look for existing bus before failing

What we are aiming for here is that `dbus-launch --autolaunch` will
exit with an error if it would have been unable to advertise the bus
in a way that will be picked up by other instances of itself, so that
we don't get a proliferation of autolaunched dbus-launch instances,
each with its own dbus-daemon, and none of them talking to the others.

However, we don't need to do that *immediately*: we can try to look for
an existing instance first. If we find one, then we can assume that
it's suitable for use, even if X11 autolaunching was disabled at
compile-time or if connecting to the X server failed at runtime. We
only need to bail out if we get to the point where we are ready to start
forking child processes.

This lets systemd users run `dbus-launch --autolaunch` to find a
systemd-managed dbus-daemon, even if X11 autolaunching is disabled.
When combined with the previous commit, it also lets macOS users run
`dbus-launch --autolaunch` to find a launchd-managed dbus-daemon.

Resolves: dbus/dbus#385
Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agodbus-launch: Generalize support for discovering an existing bus
Simon McVittie [Wed, 16 Mar 2022 13:24:53 +0000 (13:24 +0000)] 
dbus-launch: Generalize support for discovering an existing bus

Previously we were looking for an existing bus via
_dbus_lookup_user_bus(), meaning a user bus $XDG_RUNTIME_DIR/bus
(in practice this is managed by systemd --user, although in principle
there's nothing to stop other session frameworks from providing the
same thing).

_dbus_lookup_session_address() looks for an externally-managed
dbus-daemon in a more general way: on macOS it uses launchd, and on other
Unix it's a thin wrapper around _dbus_lookup_user_bus(). Let's try that,
so that macOS users can get their existing dbus-daemon from launchd.

This partially resolves dbus/dbus#385, although initially only for macOS
users who have (unusually) enabled X11 autolaunching support.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'ci-opensuse-support' into 'master'
Ralf Habacker [Tue, 29 Mar 2022 14:24:04 +0000 (14:24 +0000)] 
Merge branch 'ci-opensuse-support' into 'master'

On CI add support for building package based on openSUSE distribution

Closes #383

See merge request dbus/dbus!192

3 years agoCI: Switch active cmake related jobs to opensuse as default
Ralf Habacker [Tue, 1 Mar 2022 12:30:45 +0000 (13:30 +0100)] 
CI: Switch active cmake related jobs to opensuse as default

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agoOn CI add build support for openSUSE distributions
Ralf Habacker [Tue, 1 Mar 2022 12:25:01 +0000 (13:25 +0100)] 
On CI add build support for openSUSE distributions

The mingw related jobs are running the whole test suite which
is an extension to the available jobs.

The environment variable ci_suite is not used on openSUSE
distributions, as it is determined from the installed image.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agocmake: temporary disable fatal warnings related to new opensuse builds
Ralf Habacker [Thu, 17 Mar 2022 13:28:34 +0000 (14:28 +0100)] 
cmake: temporary disable fatal warnings related to new opensuse builds

This is necessary for these CI builds to be successful.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agoMerge branch 'compile-with-clang' into 'master'
Ralf Habacker [Tue, 29 Mar 2022 12:36:47 +0000 (12:36 +0000)] 
Merge branch 'compile-with-clang' into 'master'

cmake: Only add warning flags if the compiler supports them

Closes #387

See merge request dbus/dbus!276

3 years agocmake: Only add warning flags if the compiler supports them
Alex Richardson [Sat, 19 Mar 2022 14:58:59 +0000 (14:58 +0000)] 
cmake: Only add warning flags if the compiler supports them

I am compiling for FreeBSD where the compiler is Clang and doesn't accept
all the GCC warning flags. This breaks the -Werror build:
```
error: unknown warning option '-Wduplicated-branches' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wduplicated-cond' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wjump-misses-init' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wlogical-op'; did you mean '-Wlong-long'? [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wrestrict' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wunused-but-set-variable'; did you mean '-Wunused-const-variable'? [-Werror,-Wunknown-warning-option]
```

With this change we use check_{c,cxx}_compiler_flag to check if the flag
is supported before adding it. In the future this will allow adding
clang-specific warning flags to the list of warnings as well since they
will be ignored for GCC.

3 years agoMerge branch 'bug834725' into 'master'
Simon McVittie [Tue, 29 Mar 2022 12:19:58 +0000 (12:19 +0000)] 
Merge branch 'bug834725' into 'master'

sysdeps-unix: check fd before calling _dbus_fd_set_close_on_exec()

See merge request dbus/dbus!285

3 years agosysdeps-unix: check fd before calling _dbus_fd_set_close_on_exec()
Mike Gilbert [Sun, 27 Mar 2022 19:09:48 +0000 (15:09 -0400)] 
sysdeps-unix: check fd before calling _dbus_fd_set_close_on_exec()

If /proc/self/oom_score_adj does not exist, fd will invalid (-1).
Attempting to set the CLOEXEC flag will obviously fail, and we lose the
original errno value from open().

Bug: https://bugs.gentoo.org/834725
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
3 years agoMerge branch 'cross-compile-session-socket' into 'master'
Ralf Habacker [Tue, 29 Mar 2022 11:49:56 +0000 (11:49 +0000)] 
Merge branch 'cross-compile-session-socket' into 'master'

cmake: Fix DBUS_SESSION_SOCKET_DIR when cross-compiling

See merge request dbus/dbus!279

3 years agocmake: Fix DBUS_SESSION_SOCKET_DIR when cross-compiling
Alex Richardson [Sat, 19 Mar 2022 14:56:12 +0000 (14:56 +0000)] 
cmake: Fix DBUS_SESSION_SOCKET_DIR when cross-compiling

Inferring it from the environment is not correct, since the host system
could have a different temporary directory defined. Instead of guessing
based on the host, require the user to pass an explicit directory when
cross-compiling. This is helpful for me since I am cross-compiling for
FreeBSD from macOS and on my host TMPDIR is set to
/var/folders/<random characters>/T/ instead of the expected /tmp.

3 years agoMerge branch 'fix-fetching-mingw-packages' into 'master'
Ralf Habacker [Tue, 29 Mar 2022 11:39:45 +0000 (11:39 +0000)] 
Merge branch 'fix-fetching-mingw-packages' into 'master'

tools/ci-install.sh: on debian|ubuntu reduce the need for mingw package name changes

Closes #388

See merge request dbus/dbus!286

3 years ago.gitignore: Ignore downloaded and installed mingw packages used on debian|ubuntu
Ralf Habacker [Tue, 29 Mar 2022 08:00:26 +0000 (10:00 +0200)] 
.gitignore: Ignore downloaded and installed mingw packages used on debian|ubuntu

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agotools/ci-install.sh: clean up the previously used installation prefix and the downloa...
Ralf Habacker [Tue, 29 Mar 2022 07:59:59 +0000 (09:59 +0200)] 
tools/ci-install.sh: clean up the previously used installation prefix and the downloaded mingw packages

This is necessary to have a clean initial state when running the script
locally.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agotools/ci-install.sh: Use partially qualified versions with mingw package names
Ralf Habacker [Tue, 29 Mar 2022 07:56:40 +0000 (09:56 +0200)] 
tools/ci-install.sh: Use partially qualified versions with mingw package names

Fixes dbus/dbus#388

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agotools/ci-install.sh: on debian|ubuntu reduce the need for mingw package name changes
Ralf Habacker [Tue, 29 Mar 2022 07:36:54 +0000 (09:36 +0200)] 
tools/ci-install.sh: on debian|ubuntu reduce the need for mingw package name changes

Instead of having to specify an exact version that needs to be adjusted
with each repository update, it is now possible to specify package names
without version or partially qualified versions, which reduces the
frequency of necessary adjustments.

This is achieved by searching for the package names in a previously
downloaded list of available packages.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agoMerge branch 'cmake-fix-export-dynamic' into 'master'
Ralf Habacker [Thu, 24 Mar 2022 22:13:55 +0000 (22:13 +0000)] 
Merge branch 'cmake-fix-export-dynamic' into 'master'

cmake: Only pass -Wl,--export-dynamic when linking

See merge request dbus/dbus!278

3 years agocmake: Use -Wl,-export_dynamic when building for macOS
Alex Richardson [Sat, 19 Mar 2022 19:23:32 +0000 (19:23 +0000)] 
cmake: Use -Wl,-export_dynamic when building for macOS

The macOS linker does not accept --export-dynamic, so use this
alternate spelling.

3 years agocmake: Only pass -Wl,--export-dynamic when linking
Alex Richardson [Sat, 19 Mar 2022 17:56:54 +0000 (17:56 +0000)] 
cmake: Only pass -Wl,--export-dynamic when linking

Otherwise we get the following warnings when building .o files with Clang:
clang-13: warning: -Wl,--export-dynamic: 'linker' input unused [-Wunused-command-line-argument]

This is required to allow the -Werror build to pass on FreeBSD.

3 years agoMerge branch 'cmake-unnecessary-include-dir' into 'master'
Ralf Habacker [Thu, 24 Mar 2022 14:36:15 +0000 (14:36 +0000)] 
Merge branch 'cmake-unnecessary-include-dir' into 'master'

cmake: Drop an unnecessary include directory

See merge request dbus/dbus!282

3 years agocmake: Drop an unnecessary include directory
Alex Richardson [Wed, 23 Mar 2022 22:06:33 +0000 (22:06 +0000)] 
cmake: Drop an unnecessary include directory

There should be no need to include the directory above the DBus sources,
if that is actually required users can always pass -I flags to CMake.
I noticed this because CLion started indexing all my cloned projects when
I opened DBus due to this include path.

3 years agoMerge branch 'detect-backtrace-freebsd' into 'master'
Ralf Habacker [Thu, 24 Mar 2022 13:56:13 +0000 (13:56 +0000)] 
Merge branch 'detect-backtrace-freebsd' into 'master'

cmake: Detect backtrace() support on platforms such as FreeBSD

See merge request dbus/dbus!281

3 years agocmake: Detect backtrace() support on platforms such as FreeBSD
Alex Richardson [Sun, 20 Mar 2022 23:25:29 +0000 (23:25 +0000)] 
cmake: Detect backtrace() support on platforms such as FreeBSD

On FreeBSD use of backtrace requires linking libexecinfo. The current
check_symbol_exists() will fail due to that missing library. Fortunately,
CMake ships with a FindBacktrace module (at least since 3.0) that can
be used to correctly handle platforms such as FreeBSD (and OpenBSD
according to the FindBacktrace source).

3 years agoMerge branch 'fix-freebsd-environ' into 'master'
Ralf Habacker [Thu, 24 Mar 2022 13:40:44 +0000 (13:40 +0000)] 
Merge branch 'fix-freebsd-environ' into 'master'

Revert "Fix gcc compile error: redundant redeclaration of ‘environ’ [-Werror=redundant-decls]"

See merge request dbus/dbus!277

3 years agoRevert "Fix gcc compile error: redundant redeclaration of ‘environ’ [-Werror=redundan...
Alex Richardson [Sat, 19 Mar 2022 14:48:04 +0000 (14:48 +0000)] 
Revert "Fix gcc compile error: redundant redeclaration of ‘environ’ [-Werror=redundant-decls]"

Breaks the build on FreeBSD which doens't have an environ declaration.
The CMake check_symbol_exists call sets `HAVE_DECL_ENVIRON` to an empty
variable (which means if(DEFINED) suceeds). This normalization should not
be necessary as it will be handled correctly by `#cmakedefine01`. If not,
all the other HAVE_* defines would also be wrong.

This reverts commit e8b34b419e44e0b95622f45c0f17487e241b1961.

3 years agoMerge branch 'issue-templates' into 'master'
Ralf Habacker [Fri, 18 Mar 2022 07:47:10 +0000 (07:47 +0000)] 
Merge branch 'issue-templates' into 'master'

Add bug and feature template for issue tracker

See merge request dbus/dbus!270

3 years agoAdd feature template
Ralf Habacker [Thu, 10 Mar 2022 12:16:37 +0000 (13:16 +0100)] 
Add feature template

3 years agoAdd bug template
Ralf Habacker [Thu, 10 Mar 2022 12:06:42 +0000 (13:06 +0100)] 
Add bug template

3 years agoMerge branch 'memcmp' into 'master'
Simon McVittie [Wed, 16 Mar 2022 15:58:11 +0000 (15:58 +0000)] 
Merge branch 'memcmp' into 'master'

sysdeps: Implement _DBUS_DOUBLES_BITWISE_EQUAL with memcmp

See merge request dbus/dbus!274

3 years agosysdeps: Implement _DBUS_DOUBLES_BITWISE_EQUAL with memcmp
Simon McVittie [Wed, 16 Mar 2022 14:54:55 +0000 (14:54 +0000)] 
sysdeps: Implement _DBUS_DOUBLES_BITWISE_EQUAL with memcmp

memcmp is the Standard C way to compare arbitrary regions of memory
bit-by-bit, so let's use it, instead of reinventing it in a way that
violates Standard C aliasing rules.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agotools/ci-build.sh: Define and use variable builddir
Ralf Habacker [Fri, 10 Dec 2021 11:00:36 +0000 (12:00 +0100)] 
tools/ci-build.sh: Define and use variable builddir

Reviewed-by: Simon McVittie <smcv@collabora.com>
3 years ago.gitignore: Add sub directory ci-build*
Ralf Habacker [Thu, 25 Nov 2021 12:07:36 +0000 (13:07 +0100)] 
.gitignore: Add sub directory ci-build*

Reviewed-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'ci-job-names' into 'master'
Simon McVittie [Wed, 16 Mar 2022 14:03:22 +0000 (14:03 +0000)] 
Merge branch 'ci-job-names' into 'master'

CI: Adjust job names

See merge request dbus/dbus!262

3 years agoCI: Adjust job names
Ralf Habacker [Tue, 1 Mar 2022 12:20:43 +0000 (13:20 +0100)] 
CI: Adjust job names

Job names now provide more information about platform, build environment,
system and configuration, which makes it easier to read.

The names for the build environments has been shorted to commonly known
names e.g. 'mingw64' for 'x86_64-w64-mingw32'.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agoMerge branch 'fix-issue-381' into 'master'
Ralf Habacker [Tue, 8 Mar 2022 15:07:13 +0000 (15:07 +0000)] 
Merge branch 'fix-issue-381' into 'master'

cmake: Fix race condition on creating docbook based files

Closes #381

See merge request dbus/dbus!268

3 years agocmake: Fix race condition on creating docbook based files
Ralf Habacker [Thu, 3 Mar 2022 11:40:17 +0000 (12:40 +0100)] 
cmake: Fix race condition on creating docbook based files

With the previous implementation, race conditions could arise because a
generated intermediate file was used by multiple targets.

To fix the mentioned problem, the macro 'generate_docbook_file' has been
integrated into a in a new macro 'add_docbook' to simplify the dependency
chain and make it easier to use.

When using an xml template with the 'TEMPLATE' parameter, a separate
intermediate xml file is used for each generated output file to avoid
overwriting each other, which was the main cause of the described problem.

Due to the adaptation of the calling conventions it was necessary to
introduce the parameter 'MAN_CATEGORY'.

Fixes #381

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agoMerge branch 'fix-issue-375-1' into 'master'
Ralf Habacker [Fri, 4 Mar 2022 07:26:15 +0000 (07:26 +0000)] 
Merge branch 'fix-issue-375-1' into 'master'

cmake: fix setting DBUS_*_CONFIG_FILE on non win32 platform

See merge request dbus/dbus!267

3 years agocmake: Set DBUS_*_CONFIG_FILE to be in datadir on Unix
Ralf Habacker [Thu, 3 Mar 2022 08:48:51 +0000 (09:48 +0100)] 
cmake: Set DBUS_*_CONFIG_FILE to be in datadir on Unix

The files were installed to the datadir (usually /usr/share) since
commit 70950325, but the macros used to implement dbus-daemon --system
and dbus-daemon --session still looked for them in the sysconfdir
(usually /etc).

Fixes: 70950325 "Adjust cmake build to match autoconf installation locations"
3 years agoMerge branch 'fix-issue-375' into 'master'
Ralf Habacker [Thu, 3 Mar 2022 11:45:09 +0000 (11:45 +0000)] 
Merge branch 'fix-issue-375' into 'master'

cmake: setup variable WORDS_BIGENDIAN correctly

Closes #375

See merge request dbus/dbus!266

3 years agocmake: setup variable WORDS_BIGENDIAN correctly
Ralf Habacker [Wed, 2 Mar 2022 10:00:06 +0000 (11:00 +0100)] 
cmake: setup variable WORDS_BIGENDIAN correctly

Since version 3.0 cmake provides the macro test_big_endian for
that purpose.

fixes #375

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agoAdd api doc to _dbus_platform_c|rmutex_new()
Ralf Habacker [Mon, 21 Feb 2022 15:07:48 +0000 (16:07 +0100)] 
Add api doc to _dbus_platform_c|rmutex_new()

The documentation has been added to the header to avoid duplication as
these functions are implemented platform specific.

Cherry-picked from merge request dbus/dbus!243

Reviewed-by: @smcv
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agoUpdate NEWS
Simon McVittie [Tue, 1 Mar 2022 18:44:25 +0000 (18:44 +0000)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>