]> git.ipfire.org Git - thirdparty/dbus.git/log
thirdparty/dbus.git
3 years agosysdeps-win: Add support to give auto launched dbus daemon custom parameter
Ralf Habacker [Mon, 20 Dec 2021 13:40:38 +0000 (14:40 +0100)] 
sysdeps-win: Add support to give auto launched dbus daemon custom parameter

For that purpose the function _dbus_test_win_set_autolaunch_command_line_parameter()
has been added.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agoFix indentation of functions that are later changed
Ralf Habacker [Thu, 16 Dec 2021 13:42:27 +0000 (14:42 +0100)] 
Fix indentation of functions that are later changed

3 years agobuild: Include license files in releases
Simon McVittie [Fri, 24 Jun 2022 13:44:08 +0000 (14:44 +0100)] 
build: Include license files in releases

Fixes: 272928b "COPYING: Move full license text into LICENSES/"
Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agobuild-sys: drop DBUS_CMAKE
Marc-André Lureau [Tue, 24 May 2022 20:12:18 +0000 (22:12 +0200)] 
build-sys: drop DBUS_CMAKE

TEST_LISTEN is defined by the cmake/autotools (or meson) build systems.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agoCOPYING: Document what we mean by SPDX markers
Simon McVittie [Wed, 18 May 2022 13:05:20 +0000 (14:05 +0100)] 
COPYING: Document what we mean by SPDX markers

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoCOPYING, CONTRIBUTING.md: Specifically mention the MIT license
Simon McVittie [Wed, 18 May 2022 13:04:58 +0000 (14:04 +0100)] 
COPYING, CONTRIBUTING.md: Specifically mention the MIT license

This is the license we encourage contributors to use for new code, so
we should certainly have a reference copy of it.

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoCOPYING: Move full license text into LICENSES/
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>
3 years agoCOPYING: The project is called dbus, not D-Bus
Simon McVittie [Wed, 18 May 2022 12:59:17 +0000 (13:59 +0100)] 
COPYING: The project is called dbus, not D-Bus

We are trying to be consistent about saying this codebase is dbus
(a piece of software), which is the reference implementation of D-Bus
(a protocol).

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'implicit-func-def-configure' into 'master'
Simon McVittie [Thu, 26 May 2022 11:41:02 +0000 (11:41 +0000)] 
Merge branch 'implicit-func-def-configure' into 'master'

configure: Avoid exit() when checking for __sync_sub_and_fetch()

See merge request dbus/dbus!320

3 years agoconfigure: Avoid exit() when checking for __sync_sub_and_fetch()
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.

3 years agoMerge branch 'getresuid' into 'master'
Simon McVittie [Thu, 26 May 2022 11:26:13 +0000 (11:26 +0000)] 
Merge branch 'getresuid' into 'master'

cmake: Check for setresuid and getresuid

See merge request dbus/dbus!319

3 years agocmake: Check for setresuid and getresuid
Alex Richardson [Wed, 25 May 2022 22:00:08 +0000 (22:00 +0000)] 
cmake: Check for setresuid and getresuid

This was not being checked, so the codepaths using the define were
never included.

3 years agoMerge branch 'wip/jtojnar/nodist-catalog' into 'master'
Simon McVittie [Tue, 24 May 2022 11:38:52 +0000 (11:38 +0000)] 
Merge branch 'wip/jtojnar/nodist-catalog' into 'master'

build: Do not dist built XML catalog

See merge request dbus/dbus!317

3 years agobuild: Do not dist built XML catalog
Jan Tojnar [Sun, 22 May 2022 19:45:27 +0000 (21:45 +0200)] 
build: Do not dist built XML catalog

It will have whatever paths the person who built the dist tarball hardcoded.

3 years agoUpdate NEWS
Simon McVittie [Mon, 23 May 2022 12:41:34 +0000 (13:41 +0100)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'dev_add_variant_type_to_dbus_send' into 'master'
Simon McVittie [Mon, 23 May 2022 12:32:06 +0000 (12:32 +0000)] 
Merge branch 'dev_add_variant_type_to_dbus_send' into 'master'

dbus-send: Support for variants inside containers

See merge request dbus/dbus!206

3 years agodbus-send: Add support for variants to arrays and dictionaries
Frederik Van Bogaert [Sat, 17 Apr 2021 22:02:45 +0000 (00:02 +0200)] 
dbus-send: Add support for variants to arrays and dictionaries

Adds support for:
* Arrays of variants
* Dictionaries with variants as keys

Manually tested and confirmed working using dbus-monitor.
Example usage:
```
$ dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus \
    com.example.SomeExample dict:string:variant:one,int16:1
```
In dbus-monitor:
```
method call time=1652796044.991509 sender=:1.84 -> destination=org.freedesktop.DBus
    serial=2 path=/org/freedesktop/DBus; interface=com.example; member=SomeExample
   array [
      dict entry(
         string "one"
         variant             int16 1
      )
   ]
```

Signed-off-by: Frederik Van Bogaert <frederik.vanbogaert@mind.be>
3 years agoMerge branch 'element-size-morello' into 'master'
Simon McVittie [Mon, 23 May 2022 12:13:26 +0000 (12:13 +0000)] 
Merge branch 'element-size-morello' into 'master'

dbus-mempool.c: Ensure element_size is at least sizeof(void *)

See merge request dbus/dbus!318

3 years agodbus-mempool.c: Ensure element_size is at least sizeof(void *)
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 *).

3 years agoMerge branch 'drop-auth-dir' into 'master'
Simon McVittie [Fri, 20 May 2022 13:53:36 +0000 (13:53 +0000)] 
Merge branch 'drop-auth-dir' into 'master'

build-sys: console-auth-dir leftovers

See merge request dbus/dbus!316

3 years agobuild-sys: console-auth-dir leftovers
Marc-André Lureau [Fri, 20 May 2022 13:24:53 +0000 (15:24 +0200)] 
build-sys: console-auth-dir leftovers

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agoUpdate NEWS
Simon McVittie [Fri, 20 May 2022 13:21:55 +0000 (14:21 +0100)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'editorconfig' into 'master'
Simon McVittie [Fri, 20 May 2022 12:31:25 +0000 (12:31 +0000)] 
Merge branch 'editorconfig' into 'master'

.editorconfig: Automatically configure multiple text editors

See merge request dbus/dbus!310

3 years ago.editorconfig: Automatically configure multiple text editors
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>
3 years agoMerge branch 'drop-auth-dir' into 'master'
Simon McVittie [Fri, 20 May 2022 12:08:30 +0000 (12:08 +0000)] 
Merge branch 'drop-auth-dir' into 'master'

Remove DBUS_CONSOLE_AUTH_DIR

See merge request dbus/dbus!314

3 years agoNEWS: add note about DBUS_CONSOLE_AUTH_DIR removal
Marc-André Lureau [Thu, 19 May 2022 15:30:22 +0000 (17:30 +0200)] 
NEWS: add note about DBUS_CONSOLE_AUTH_DIR removal

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agocmake: drop -DDBUS_CONSOLE_AUTH_DIR=
Marc-André Lureau [Thu, 19 May 2022 15:29:51 +0000 (17:29 +0200)] 
cmake: drop -DDBUS_CONSOLE_AUTH_DIR=

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agoautotools: drop --with-console-auth-dir=
Marc-André Lureau [Thu, 19 May 2022 15:29:29 +0000 (17:29 +0200)] 
autotools: drop --with-console-auth-dir=

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agodbus: remove pam_console/pam_foreground support
Marc-André Lureau [Thu, 19 May 2022 15:28:08 +0000 (17:28 +0200)] 
dbus: remove pam_console/pam_foreground support

DBUS_CONSOLE_AUTH_DIR is deprecated since 1.11.18, and was intended to
have been removed in 1.13. Let's drop the related code now.

Fixes: https://gitlab.freedesktop.org/dbus/dbus/-/issues/181
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=101629
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agoMerge branch 'warnings' into 'master'
Simon McVittie [Thu, 19 May 2022 18:15:58 +0000 (18:15 +0000)] 
Merge branch 'warnings' into 'master'

Fix unused warnings

See merge request dbus/dbus!315

3 years agotest: fix unused variable warnings
Marc-André Lureau [Thu, 19 May 2022 15:56:59 +0000 (17:56 +0200)] 
test: fix unused variable warnings

../../test/internals/assertions.c: In function ‘test_assert_error_is_set’:
../../test/internals/assertions.c:82:14: warning: unused variable ‘ep’ [-Wunused-variable]
   82 |   DBusError *ep = NULL;
      |              ^~
../../test/internals/assertions.c:81:13: warning: unused variable ‘e’ [-Wunused-variable]
   81 |   DBusError e = DBUS_ERROR_INIT;

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agodbus: fix unused warning
Marc-André Lureau [Thu, 19 May 2022 15:51:14 +0000 (17:51 +0200)] 
dbus: fix unused warning

../../dbus/dbus-message.c:5462:17: warning: variable ‘len’ set but not used [-Wunused-but-set-variable]
 5462 |   unsigned char len;

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agoMerge branch 'doc-https' into 'master'
Simon McVittie [Wed, 18 May 2022 16:21:49 +0000 (16:21 +0000)] 
Merge branch 'doc-https' into 'master'

doc: Use https URLs for home page and AUTHORS

See merge request dbus/dbus!313

3 years agodoc: Use https URLs for home page and AUTHORS
Simon McVittie [Wed, 18 May 2022 15:50:50 +0000 (16:50 +0100)] 
doc: Use https URLs for home page and AUTHORS

Signed-off-by: Simon McVittie <smcv@collabora.com>
3 years agoMerge branch 'meson-prep' into 'master'
Simon McVittie [Wed, 18 May 2022 15:56:23 +0000 (15:56 +0000)] 
Merge branch 'meson-prep' into 'master'

Preparation for Meson build system

See merge request dbus/dbus!312

3 years agodbus: fix warning: label 'oom' defined but not used
Marc-André Lureau [Thu, 3 Feb 2022 07:13:35 +0000 (11:13 +0400)] 
dbus: fix warning: label 'oom' defined but not used

When DBUS_ENABLE_VERBOSE_MODE is not set, the compiler warns.

Let's remove the label.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agodoc: silence some xmlto man pages warnings
Marc-André Lureau [Tue, 8 Feb 2022 18:31:14 +0000 (22:31 +0400)] 
doc: silence some xmlto man pages warnings

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

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agoDoxyfile: browse for build-dir sources
Marc-André Lureau [Tue, 17 May 2022 11:52:15 +0000 (13:52 +0200)] 
Doxyfile: browse for build-dir sources

This allows it to pick dbus-arch-deps.h as well when building out-of-tree.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
3 years agoMerge branch 'clang-format-config' into 'master'
Simon McVittie [Wed, 18 May 2022 12:04:57 +0000 (12:04 +0000)] 
Merge branch 'clang-format-config' into 'master'

Add a clang-format configuration file

See merge request dbus/dbus!308

3 years agoAdd a clang-format configuration file
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.

3 years agoMerge branch 'fix-issue-368' into 'master'
Simon McVittie [Tue, 17 May 2022 23:24:28 +0000 (23:24 +0000)] 
Merge branch 'fix-issue-368' into 'master'

Fix thread locking issues on Windows

Closes #368 and #370

See merge request dbus/dbus!244

3 years agoOn Windows in autolaunch related function use rmutex related functions to support...
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.

Fixes #368, #370

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
3 years agoMerge branch 'silence-clang-wcast-align' into 'master'
Simon McVittie [Tue, 17 May 2022 14:50:50 +0000 (14:50 +0000)] 
Merge branch 'silence-clang-wcast-align' into 'master'

Silence Clang -Wcast-align false-positives

See merge request dbus/dbus!305

3 years agodbus-memory.c: Silence -Wcast-align warnings
Alex Richardson [Sun, 15 May 2022 10:24:15 +0000 (11:24 +0100)] 
dbus-memory.c: Silence -Wcast-align warnings

These values will be appropriately aligned, so we can silence the warning
by adding a void* cast.

3 years agodbus-marshal-bytes.c: Silence -Wcast-align warnings
Alex Richardson [Sun, 15 May 2022 10:23:29 +0000 (11:23 +0100)] 
dbus-marshal-bytes.c: Silence -Wcast-align warnings

We have ensured that the values are aligned at runtime, but Clang's
warning cannot see that. Silence the warning with a void* cast.

3 years agodbus-sysdeps-unix.c: Silence -Wcast-align when using CMSG_DATA
Alex Richardson [Sun, 15 May 2022 10:14:02 +0000 (11:14 +0100)] 
dbus-sysdeps-unix.c: Silence -Wcast-align when using CMSG_DATA

This triggers when building on FreeBSD with clang, but since we know that
the CMSG_DATA() will be aligned we can silence the warning using a cast.

3 years agodbus-string.c: use memcpy() in _dbus_string_insert_{2,4,8}_aligned
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).

3 years agodbus-marshal-basic.c: Silence Clang -Wcast-align false-positives
Alex Richardson [Fri, 13 May 2022 19:25:23 +0000 (20:25 +0100)] 
dbus-marshal-basic.c: Silence Clang -Wcast-align false-positives

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.

3 years agoMerge branch 'cmake-junit-xml-output' into 'master'
Ralf Habacker [Tue, 17 May 2022 11:02:17 +0000 (11:02 +0000)] 
Merge branch 'cmake-junit-xml-output' into 'master'

tools/ci-build.sh: Add a ci_cmake_junit_output argument

See merge request dbus/dbus!299

3 years agotools/ci-install.sh: Install newer CMake on openSuSE
Alex Richardson [Sat, 14 May 2022 18:24:21 +0000 (19:24 +0100)] 
tools/ci-install.sh: Install newer CMake on openSuSE

This is needed for JUnit XML output for tests.

3 years agotools/ci-build.sh: Add a ci_cmake_junit_output argument
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.

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>