Commit graph

6666 commits

Author SHA1 Message Date
Ralf Habacker
ad6f030ef2 Merge branch 'goto-considered-unnecessary' into 'master'
Use 'continue' keyword in preference to 'goto' where possible

See merge request dbus/dbus!356
2022-11-29 19:02:38 +00:00
Simon McVittie
54b56ab875 Use 'continue' keyword in preference to 'goto' where possible
In some more complicated loops, we do need to use 'goto' to exit from
an inner loop, or to jump to cleanup or an increment of an iterator
immediately before the next loop iteration. However, in these simple
cases, jumping to a label immediately before the 'while' keyword is
unnecessary: we can use an equivalent 'continue' statement for flow
control.

This makes it easier for maintainers to notice the loops where we are
doing something more complicated, which still use 'goto', and know
that they need to pay more attention in those cases.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-11-29 18:50:06 +00:00
Ralf Habacker
2f9d987c0a Merge branch 'spdx' into 'master'
Add SPDX licensing information for the uncommon licenses (not AFL-2.1|GPL-2.0+ and not MIT)

See merge request dbus/dbus!311
2022-11-29 17:53:36 +00:00
Ralf Habacker
e3a365e7ac tools/cmake-format: Relicense to BSD-3-Clause
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-11-29 13:33:53 +00:00
Simon McVittie
d6abc1da02 cmake: Add BSD-style licenses
I've erred on the side of caution and treated the COPYING-CMAKE-SCRIPTS
license (a BSD-3-Clause variation) as its own distinct license.

Co-authored-by: Ralf Habacker <ralf.habacker@freenet.de>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-11-29 13:33:53 +00:00
Ralf Habacker
8c1d0f1391 dbus/dbus-backtrace-win.c: New file with backtrace generator for Windows
This file was added to simplify the license documentation, because the
code moved from dbus-sysdeps-win.c is subject to a different license.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
[smcv: keep license grant; add to Meson build system]
Co-authored-by: Simon McVittie <smcv@collabora.com>
2022-11-29 13:33:53 +00:00
Simon McVittie
33bc01e1b5 tools: Mark GPL-only files with SPDX license identifier
These files are licensed under the GPL only, without the AFL dual-license
of most of the dbus codebase.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Co-authored-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-11-29 13:33:53 +00:00
Simon McVittie
205063a0a9 dbus-arch-deps: Mark as AFL-2.0 OR GPL-2.0-or-later
This was probably meant to be relicensed from AFL-2.0 to AFL-2.1 at the
same time as the rest of the codebase, but it wasn't. For now, just
convert its documented license status into machine-readable form.

The history of this file seems to be completely Red Hat and Collabora,
so we should be able to relicense it to (AFL-2.1 OR GPL-2.0-or-later)
or even to MIT, but let's start by making the stated license more
obvious.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-11-29 13:33:53 +00:00
Simon McVittie
eae69d2c1a dbus-hash: Add (AFL-2.1 OR GPL-2.0-or-later) AND TCL SPDX license identifier
The TCL-derived code is under its own license, so the overall license
of the file is (AFL-2.1 OR GPL-2.0-or-later) AND TCL.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-11-29 13:33:53 +00:00
Ralf Habacker
d0d4d4d3d3 dbus/dbus-sha.c: add LicenseRef-pycrypto-orig SPDX license marker
This permissive license does not appear to be a match for anything
on the SPDX license list, so we need to use the LicenseRef- prefix
for a custom license.

Co-authored-by: Simon McVittie <smcv@collabora.com>
2022-11-29 13:33:53 +00:00
Ralf Habacker
87ebf5ecc2 dbus/versioninfo.rc.in: add LicenseRef-GAP SPDX license marker
This permissive license does not appear to be a match for anything
on the SPDX license list, so we need to use the LicenseRef- prefix
for a custom license.

It's referred to as GAP (presumably short for "GNU all-permissive") in
https://sources.debian.org/src/libassuan/2.5.5-1/debian/copyright/
so use the same abbreviation here.

Co-authored-by: Simon McVittie <smcv@collabora.com>
2022-11-29 13:33:53 +00:00
Simon McVittie
b30c2c293d Merge branch 'clang-ci' into 'master'
ci: build dbus with clang as well

See merge request dbus/dbus!358
2022-10-14 14:40:46 +00:00
Evgeny Vereshchagin
738d8dbe6f ci: get UBSan to fail and print full backtraces
Unlike ASan, by default UBSan prints one-line warnings and keeps going
and it makes it impossible for the CI to catch issues automatically when
it runs the unit tests. With this patch applied the CI should be able to
prevent issues like
https://gitlab.freedesktop.org/smcv/dbus-issue413/-/merge_requests/1#note_1549306
from making it into the repository going forward.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2022-10-13 03:20:31 +00:00
Evgeny Vereshchagin
9803fb09fc ci: build dbus with clang as well
It should make it possible to catch issues like
like https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/357

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2022-10-13 03:20:07 +00:00
Simon McVittie
0c3702bfd8 Merge branch 'mit-license-some-tests' into 'master'
Add copyright holders and MIT license to some tests that did not specify

See merge request dbus/dbus!359
2022-10-12 12:08:46 +00:00
Simon McVittie
4aa7052c6f test-exit: Add a permissive license
Red Hat have previously given permission for relicensing, and all
subsequent contributions to this file were trivial.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-12 12:08:38 +00:00
Simon McVittie
fb1460ee32 test-threads-init: Add a permissive license
With permission from Philip Withnall on behalf of Endless, me on behalf
of Collabora, and relying on previous permission from Red Hat
representatives.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-12 12:08:38 +00:00
Simon McVittie
2e705c9b49 manual-tcp: Add a permissive license
With permission from Ralf Habacker via dbus!304 and the mailing list.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-12 12:08:38 +00:00
Simon McVittie
31a2624796 manual-paths: Apply a permissive license
This was contributed by Ralf Habacker and later edited by me, with a
trivial change from Thomas Zimmermann which I don't think affects its
copyright.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-12 12:08:38 +00:00
Simon McVittie
82b3c6b7dd manual-dir-iter: Apply a permissive license
This was contributed by Ralf Habacker, with a trivial change from
Philip Withnall which I don't think affects its copyright.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-12 12:08:38 +00:00
Simon McVittie
ada440c5ba test-shutdown: Apply a permissive license
All significant contributions to this file were from companies or
individuals that gave permission for relicensing to MIT (I have assumed
that trivial changes from Marcus Brinkmann and Kjartan Maraas were too
small to affect copyright status).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-12 12:08:38 +00:00
Simon McVittie
812a690d62 test-ids: Apply a permissive license
All significant contributions to this file were from companies that gave
permission for relicensing to MIT (I have assumed that trivial changes
from Marcus Brinkmann and Ralf Habacker were too small to affect
copyright status).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-12 12:08:38 +00:00
Simon McVittie
21763bfd41 test-autolaunch: Add a permissive license
The license for this file was never stated, but all contributions to it
have been from Red Hat or Collabora, and representatives of both
companies gave permission for MIT relicensing in 2007.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-12 12:08:38 +00:00
Simon McVittie
fdd589c8d8 launch-helper-for-tests: Add a permissive license
I wrote this, and it hasn't changed since.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-12 12:08:38 +00:00
Simon McVittie
cf3203575d Merge branch 'test-autolaunch-win-fixes' into 'master'
test-autolaunch-win.c: Prevent assertion in dbus_message_unref()

Closes #422

See merge request dbus/dbus!366
2022-10-12 11:08:53 +00:00
Ralf Habacker
7724bf574c test-autolaunch-win.c: Prevent assertion in dbus_message_unref()
dbus_message_unref() is in principle able to handle a NULL parameter, but
causes the program to abort when `fatal_warnings_on_check_failed` is set.

Therefore the call with a NULL parameter is avoided from now on.

Fixes #422
2022-10-12 09:38:46 +02:00
Ralf Habacker
b081c0a553 Merge branch 'no-as-ac-expand' into 'master'
Autotools: use AX_RECURSIVE_EVAL instead of AS_AC_EXPAND

See merge request dbus/dbus!364
2022-10-12 06:41:02 +00:00
Simon McVittie
786c47b51d Autotools: use AX_RECURSIVE_EVAL instead of AS_AC_EXPAND
AX_RECURSIVE_EVAL is maintained as part of autoconf-archive, so we don't
need to bundle our own copy and keep track of its licensing status.
It's very similar to AS_AC_EXPAND, but the arguments are the other way
round and it doesn't automatically AC_SUBST its result.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-12 06:40:30 +00:00
Ralf Habacker
cced1a5e2d Merge branch 'no-pkg-m4' into 'master'
m4: Stop shipping our own copy of pkg.m4

See merge request dbus/dbus!365
2022-10-12 06:22:51 +00:00
Simon McVittie
37190b3c12 m4: Stop shipping our own copy of pkg.m4
The canonical way to find these macro is to run autogen.sh or autoreconf
while pkg-config (or pkgconf) is installed, which will copy an up-to-date
version of the macros from /usr/share/aclocal. The `make dist` archive
will include a bundled copy of those macros, but the git repository
doesn't need them.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-12 06:20:33 +00:00
Ralf Habacker
b1bc73e61d Merge branch 'autolaunch-win' into 'master'
Fixes for test-autolaunch-win

See merge request dbus/dbus!363
2022-10-11 18:23:44 +00:00
Simon McVittie
f325252e5e test-autolaunch-win: Remove redundant check for ERROR message
This seems to have been intended to give a more specific error message
if the method call failed, but it will not have been effective, because
dbus_connection_send_with_reply_and_block() ends with a check for ERROR
messages using dbus_set_error_from_message(). This means that if the
reply was an ERROR message, it will already have been converted into a
DBusError by the time call_method() regains control.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-11 18:20:53 +00:00
Simon McVittie
a7bbff5baf test-autolaunch-win: Don't overwrite an error with another error
An unrelated branch failed CI with this assertion failure:

    26: dbus[6768]: error: arguments to dbus_set_error() were incorrect,
    assertion "(error) == NULL || !dbus_error_is_set ((error))" failed in
    file ...\dbus-errors.c line 365.

Looking at the test, this seems to be the most likely candidate for
this bug in error handling, which is masking whatever the real cause
for the failure was (we can't tell from here). If
dbus_connection_send_with_reply_and_block() returns NULL, then it should
already have set the error.

Fixing this bug in the error handling will hopefully give us a better
error message for the actual failure if it happens again.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-11 18:20:53 +00:00
Simon McVittie
7cee01fca4 Merge branch 'autoconf-runstatedir' into 'master'
Use ${runstatedir} for system bus instead of ${localstatedir}/run

Closes #180

See merge request dbus/dbus!209
2022-10-11 17:53:39 +00:00
Simon McVittie
5bef1d3d13 Add NEWS entries for #180
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-11 17:15:47 +01:00
Simon McVittie
cc0544cd36 spec: Mention that the system bus address might actually be in /run
The interoperable address is unix:path=/var/run/dbus/system_bus_socket.
However, in most (perhaps all) current Linux distributions, /var/run
is guaranteed to be a symbolic link to /run, and using the path in /run
has some advantages (particularly if automounters are used).

Implementations that intend to be interoperable are not required to
listen on exactly /var/run/dbus/system_bus_socket, as long as clients
that connect to that socket will work correctly. Similarly, clients
are not required to connect to exactly /var/run/dbus/system_bus_socket,
as long as the overall system (consisting of the client and the OSs
that it supports) ensures that it ends up connecting to the same
well-known system bus that is available at
/var/run/dbus/system_bus_socket.

Because of the Unix conventions for how software installs into a prefix,
building a D-Bus implementation with its default build-time
configuration options will not necessarily result in an interoperable
system bus. The system bus is normally shipped by OS distributors,
who should ensure that they have configured it in a way that is
interoperable.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/180
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-11 17:14:11 +01:00
Issam E. Maghni
91fe77904a build: Put system bus socket in runstatedir by default
This lets OS distributors configure --runstatedir=/run if they want to,
although for interoperability, they should only do this if they can
guarantee that their /run and /var/run are equivalent.

A previous commit adds a warning if we are using the default path on a
system where /run and /var/run are not synoymous, mitigating the
compatibility impact of this change.

For CMake, this requires version 3.9, released in 2017.

For Meson, this is currently controlled by the runtime_dir option,
which defaults to /run if the prefix is /usr. The rationale for this
is that /run is correct for modern Unix systems, and distributors who
switch from Autotools or CMake to Meson need to review all their build
options at that time, which is an ideal opportunity to check that they
are doing the right thing around /run.

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/180
Co-authored-by: Simon McVittie <smcv@collabora.com>
2022-10-11 17:14:11 +01:00
Simon McVittie
e5d8d0c19a build: Show a warning if the system bus socket is not interoperable
We would like to start using ${runstatedir}/dbus/system_bus_socket,
so that distributors who make /var/run a symbolic link to /run will
usually get their dbus-daemon listening on /run/dbus/system_bus_socket,
which has some advantages in corner cases, such as when /var is mediated
by an automounter or is unmounted during system shutdown.

Unfortunately, the interoperable path in the D-Bus Specification is
/var/run/dbus/system_bus_socket for historical reasons (D-Bus is older
than /run), and older versions of Slackware are known to have had /run
and /var/run as distinct directories. Do a check during configuration
to catch systems configured like this and show a warning.

When cross-compiling, this assumes that the system where dbus is built
(the build system in Autotools/Meson, or the "host" in CMake terminology)
has its /var/run and /run set up in a way that is compatible with the
system where dbus will run (the host system in Autotools/Meson, or the
"target" in CMake terminology). This is not 100% correct, but seems good
enough for a warning that will hopefully only trigger for misguided OS
distributors.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-11 17:14:11 +01:00
Simon McVittie
ba6fb129bd build: Update a comment with the release status of Autoconf
It took a while, but Autoconf 2.70 was eventually released.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-11 17:14:11 +01:00
Simon McVittie
3ca855f264 build: Use AS_IF for system bus socket
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-11 17:14:11 +01:00
Simon McVittie
5b9d64023b Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-11 14:19:11 +01:00
Simon McVittie
98b710283a Merge branch 'spdx-syntax' into 'master'
dbus/dbus-macros-internal, test/test-platform-mutex.c: Use upper case for SPDX license operator

See merge request dbus/dbus!360
2022-10-11 13:00:13 +00:00
Ralf Habacker
4712a05874 dbus/dbus-macros-internal, test/test-platform-mutex.c: Use upper case for SPDX license operator
https://spdx.github.io/spdx-spec/SPDX-license-expressions/ says that
using upper-case operators is canonical.
2022-10-11 13:00:00 +00:00
Simon McVittie
c6173dfd83 Merge branch 'issue420' into 'master'
dbus-message: Report OOM as OOM, not InvalidArgs

Closes #420

See merge request dbus/dbus!353
2022-10-11 12:55:10 +00:00
Simon McVittie
3c0e63c10a dbus-message: Report OOM as OOM, not InvalidArgs
Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/420
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-11 11:54:21 +00:00
Simon McVittie
ccab882bad Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-11 12:53:52 +01:00
Simon McVittie
a55f29e401 Merge branch 'dispatch_peer_messages' into 'master'
dbus-monitor: Don’t send messages after becoming a monitor

Closes #301

See merge request dbus/dbus!272
2022-10-11 11:45:11 +00:00
Kai A. Hiller
bc23b03b5c dbus-connection: Test built-in filters 2022-10-11 10:50:08 +00:00
Kai A. Hiller
f1c17c74ac dbus-monitor: Disable automatic message filtering 2022-10-11 10:50:08 +00:00
Kai A. Hiller
5dba91acea dbus-connection: Add builtin_filters_enabled flag 2022-10-11 10:50:08 +00:00