Simon McVittie [Mon, 27 Jun 2022 11:42:42 +0000 (12:42 +0100)]
.gitignore: Ignore __pycache__ directories anywhere in the tree
The Meson build system adds several Python scripts, some of which import
code from other Python scripts, which will result in __pycache__
directories appearing in the source tree.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Wed, 13 Jul 2022 14:52:39 +0000 (15:52 +0100)]
spec: Document a recommendation for IDNs in reversed domain names
D-Bus names are in an ASCII subset, so IDNs have to be in their ACE
encoding (Punycode). ACE-encoded labels contain hyphen/minus characters,
and like any other label containing a hyphen/minus, we recommend
replacing those with underscores, to improve interoperability with
contexts that allow underscores but not hyphen/minus, such as
D-Bus object paths and Flatpak app-IDs.
Prompted by <https://github.com/flatpak/flatpak/issues/4974>.
Signed-off-by: Simon McVittie <smcv@collabora.com>
GCC 10.2.0 complains on opensuse mingw builds, ex:
disable-crash-handling.c: error: STABS debugging information is obsolete and not supported anymore [-Werror]
According to
https://gitlab.freedesktop.org/dbus/dbus/-/issues/133#note_129599,
-gdwarf-2 is the second best option.
Ralf Habacker [Wed, 17 Nov 2021 09:51:39 +0000 (10:51 +0100)]
Add a test application for autostart on Windows implementation
The test application performs several individual tests to detect possible
problems with the autostart support under Windows. Connections are tested
with the standard scope, a 'custom' scope, the 'install path' scope and
the 'user' scope.
Ralf Habacker [Mon, 20 Dec 2021 11:34:14 +0000 (12:34 +0100)]
sysdeps-win: Use the `connection readiness` event when starting dbus-daemon
In _dbus_get_autolaunch_address() instead of polling at intervals to see
if the shared memory segment is present, the named signal is now used to
reliably get the state of dbus-daemon.
In _dbus_get_autolaunch_shm() the unnecessary initialization of `address`
has been removed, error handling has been improved and the `wait` parameter
has been added to select waiting.
Simon McVittie [Wed, 18 May 2022 13:01:25 +0000 (14:01 +0100)]
COPYING: Move full license text into LICENSES/
Having the full text of the AFL-2.1 and GPL in this file makes it harder
to find the unique information, which is the summary. Move their full
text into LICENSES/ (consistent with how REUSE handles this), leaving
a short summary of the licensing situation in COPYING.
Loosely based on work from Ralf Habacker in dbus!304.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Alex Richardson [Wed, 25 May 2022 22:05:03 +0000 (22:05 +0000)]
configure: Avoid exit() when checking for __sync_sub_and_fetch()
Use of exit() requires a stdlib.h include. This check was failing for me
since the compiler defaulted to -Werror=implicit-function-declaration, so
__sync_sub_and_fetch() support was not dectected.
Alex Richardson [Sun, 22 May 2022 22:08:32 +0000 (22:08 +0000)]
dbus-mempool.c: Ensure element_size is at least sizeof(void *)
I am trying to use DBus on an Arm Morello system where sizeof(void *) is
16 and not 8, so the assertion in the line below can fail unless we ensure
that element_size is at least sizeof(void *).
Simon McVittie [Wed, 18 May 2022 11:46:09 +0000 (12:46 +0100)]
.editorconfig: Automatically configure multiple text editors
See editorconfig.org for details of the format. This is a first attempt
at describing our coding style in editorconfig syntax; please add new
file types here as they become relevant.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Some pages are missing AUTHOR section, xmlto complains about it, ex:
Warn: meta author : no refentry/info/author dbus-update-activation-environment
Note: meta author : see http://www.docbook.org/tdg5/en/html/autho dbus-update-activation-environment
Warn: meta author : no author data, so inserted a fixme dbus-update-activation-environment
Alex Richardson [Tue, 17 May 2022 09:26:58 +0000 (09:26 +0000)]
Add a clang-format configuration file
This ensures that IDEs such as CLion automatically use the correct
indentation, and running `git-clang-format` results in patches that are
actually quite close to the current style. It doesn't handle alignment
of parameters in function declarations, but otherwise it seems accurate.
Ralf Habacker [Thu, 3 Mar 2022 16:15:44 +0000 (17:15 +0100)]
On Windows in autolaunch related function use rmutex related functions to support thread locking
The previously used additional and incomplete functions have been merged
into the current rmutex functions to fix the reported bug and reduce the
maintenance effort.
Alex Richardson [Sun, 15 May 2022 10:12:41 +0000 (11:12 +0100)]
dbus-string.c: use memcpy() in _dbus_string_insert_{2,4,8}_aligned
This fixes a -Wcast-align warning from Clang, and I believe this could
be a genuine issue on some architectures since the octets argument is
an unsigned char pointer that only has alignment 1. Using memcpy() instead
will generate the same code on architectures that support unaligned loads
and stores (i.e. almost all current ones) and individual stores on those
that don't (e.g. old MIPS).
Clang performs the -Wcast-align analysis before code generation and
optimizations, so the compiler cannot see that the alignment is actually
guaranteed to be sufficient for these casts. Silence the warning by adding
casts to void* and/or changing the types of some variables.
Alex Richardson [Sun, 20 Mar 2022 00:40:22 +0000 (00:40 +0000)]
tools/ci-build.sh: Add a ci_cmake_junit_output argument
CMake 3.21 can emit JUnit XML test results which can be visualized by
GitLab. This also updates the gitlab CI config file to make use of this
feature whenever possible.
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.
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.
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.
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.
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>
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>
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.
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>