Commit graph

6318 commits

Author SHA1 Message Date
Marc-André Lureau
5705d14cf0 cmake: drop -DDBUS_CONSOLE_AUTH_DIR=
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-19 22:19:25 +02:00
Marc-André Lureau
cf124a41d7 autotools: drop --with-console-auth-dir=
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-19 22:19:25 +02:00
Marc-André Lureau
84fdcc5f27 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>
2022-05-19 22:19:25 +02:00
Simon McVittie
366b075dec Merge branch 'warnings' into 'master'
Fix unused warnings

See merge request dbus/dbus!315
2022-05-19 18:15:58 +00:00
Marc-André Lureau
708dd5a55e 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>
2022-05-19 17:57:31 +02:00
Marc-André Lureau
f2cf41e1ae 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>
2022-05-19 17:57:31 +02:00
Simon McVittie
c64aa0308c Merge branch 'doc-https' into 'master'
doc: Use https URLs for home page and AUTHORS

See merge request dbus/dbus!313
2022-05-18 16:21:49 +00:00
Simon McVittie
1426cf811c doc: Use https URLs for home page and AUTHORS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-18 16:05:31 +00:00
Simon McVittie
f3aee6f8ce Merge branch 'meson-prep' into 'master'
Preparation for Meson build system

See merge request dbus/dbus!312
2022-05-18 15:56:23 +00:00
Marc-André Lureau
06e7411f7e 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>
2022-05-18 16:41:23 +01:00
Marc-André Lureau
c0e2f47d3b 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>
2022-05-18 16:41:09 +01:00
Marc-André Lureau
8c2f8fc8c6 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>
2022-05-18 16:40:30 +01:00
Simon McVittie
86d891f067 Merge branch 'clang-format-config' into 'master'
Add a clang-format configuration file

See merge request dbus/dbus!308
2022-05-18 12:04:57 +00:00
Alex Richardson
a68209cb23 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.
2022-05-18 11:48:04 +00:00
Simon McVittie
cbad0a74f7 Merge branch 'fix-issue-368' into 'master'
Fix thread locking issues on Windows

Closes #368 and #370

See merge request dbus/dbus!244
2022-05-17 23:24:28 +00:00
Ralf Habacker
f888ee8028 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>
2022-05-17 23:06:54 +00:00
Simon McVittie
8b4699332d Merge branch 'silence-clang-wcast-align' into 'master'
Silence Clang -Wcast-align false-positives

See merge request dbus/dbus!305
2022-05-17 14:50:50 +00:00
Alex Richardson
f6689b4f02 dbus-memory.c: Silence -Wcast-align warnings
These values will be appropriately aligned, so we can silence the warning
by adding a void* cast.
2022-05-17 11:21:33 +00:00
Alex Richardson
13eeb2c656 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.
2022-05-17 11:21:33 +00:00
Alex Richardson
eb70deaaab 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.
2022-05-17 11:21:33 +00:00
Alex Richardson
d68c843b27 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).
2022-05-17 11:21:33 +00:00
Alex Richardson
1b72096261 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.
2022-05-17 11:21:33 +00:00
Ralf Habacker
cfde6fd49c 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
2022-05-17 11:02:17 +00:00
Alex Richardson
364fe6be69 tools/ci-install.sh: Install newer CMake on openSuSE
This is needed for JUnit XML output for tests.
2022-05-17 10:48:06 +00:00
Alex Richardson
f366b38f31 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.
2022-05-17 10:48:06 +00:00
Simon McVittie
f385a747b5 Merge branch 'fix-cmake-dbus-use-sync' into 'master'
cmake: Fix definition of DBUS_USE_SYNC

See merge request dbus/dbus!306
2022-05-16 18:52:16 +00:00
Alex Richardson
b932c343c4 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.
2022-05-16 18:39:26 +00:00
Simon McVittie
146f48ba0b Merge branch 'fix-wshadow' into 'master'
dir-watch-kqueue: Silence -Wshadow warning

See merge request dbus/dbus!307
2022-05-16 18:36:38 +00:00
Alex Richardson
2480181af4 dir-watch-kqueue: Silence -Wshadow warning
This should be the last warning that is preventing us from using -Werror
for FreeBSD builds.
2022-05-15 11:35:35 +01:00
Ralf Habacker
9722d62149 Merge branch 'ci-templates' into 'master'
Use freedesktop/ci-templates for the GitLab CI

See merge request dbus/dbus!301
2022-05-09 12:29:47 +00:00
Alex Richardson
4ce02f196b 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.
2022-05-07 16:48:29 +01:00
Simon McVittie
c6aa71b5de 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
2022-05-05 14:20:39 +00:00
Ralf Habacker
c6e1ba086f Add doc to platform related [c|r]mutex functions 2022-05-01 19:54:06 +02:00
Ralf Habacker
5f1bc83d36 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>
2022-05-01 19:52:48 +02:00
Ralf Habacker
72a7758e38 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>
2022-05-01 18:55:05 +02:00
Ralf Habacker
31307769ca Merge branch 'fix-strict-warning-related' into 'master'
Fix mingw gcc 10.3 compiler warnings

Closes #383

See merge request dbus/dbus!275
2022-05-01 16:41:06 +00:00
Ralf Habacker
29946ad7c1 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>
2022-05-01 16:28:51 +00:00
Ralf Habacker
2e63543b93 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>
2022-05-01 16:28:51 +00:00
Simon McVittie
76fe49b7ab 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>
2022-05-01 16:28:51 +00:00
Simon McVittie
f8e3736385 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>
2022-05-01 16:28:51 +00:00
Ralf Habacker
87341dab13 Merge branch 'test-socket-dir' into 'master'
cmake: Allow overriding TEST_SOCKET_DIR

See merge request dbus/dbus!295
2022-05-01 16:28:23 +00:00
Alex Richardson
856a4ee54e cmake: Allow overriding TEST_SOCKET_DIR
This matches the autotools build where that option can also be overridden.
2022-05-01 16:16:25 +00:00
Ralf Habacker
6666d9f6ff Merge branch 'cmake-user-args' into 'master'
tools/ci-build.sh: Pass user arguments to cmake last

See merge request dbus/dbus!296
2022-05-01 16:10:01 +00:00
Alex Richardson
50689407cf 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.
2022-05-01 15:57:40 +00:00
Simon McVittie
bf04d6fb54 Merge branch 'fix-c++-warnings' into 'master'
cmake: fixes for compiler warning support

Closes #387

See merge request dbus/dbus!293
2022-04-21 14:08:44 +00:00
Ralf Habacker
523796873f cmake: Let the c++ compiler use the warnings available to it
Fixes #387

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-04-21 13:51:55 +00:00
Ralf Habacker
f075650634 cmake: in macro generate_compiler_warning_flags prevent duplicates in variable containing unsupported warnings
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-04-21 13:51:55 +00:00
Ralf Habacker
fb5449e08f 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>
2022-04-21 13:51:55 +00:00
Ralf Habacker
bbd3f90a8d 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>
2022-04-21 13:51:55 +00:00
Ralf Habacker
4b73505869 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>
2022-04-21 13:56:26 +01:00