Commit graph

6225 commits

Author SHA1 Message Date
Simon McVittie
ff363d1bb0 Merge branch '1.14.x-backports' into 'dbus-1.14'
Backport various fixes from 1.15.x branch

See merge request dbus/dbus!341
2022-09-13 12:12:15 +00:00
Simon McVittie
ccb5247454 Update NEWS for 1.14.x branch
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-13 12:47:29 +01:00
Alex Richardson
a41ee157dd cmake: Always try to find pkg-config
Commit 97bdefd4e2 move the
include(FindPkgConfig) call into a Linux-specific codepath, so pkg-config
was not being detected on FreeBSD. This mean that the check for
PKG_CONFIG_FOUND to determine whether to install .pc files later on
would always fail and .pc files were not installed on FreeBSD.

(cherry picked from commit 82f5c96644)
Backported-from: dbus!280
2022-09-13 12:47:29 +01:00
Alex Richardson
a817ff39d2 cmake: Check for setresuid and getresuid
This was not being checked, so the codepaths using the define were
never included.

(cherry picked from commit dafb5ddc09)
2022-09-13 12:47:29 +01:00
Alex Richardson
e1d2cd286b dir-watch-kqueue: Silence -Wshadow warning
This should be the last warning that is preventing us from using -Werror
for FreeBSD builds.

(cherry picked from commit 2480181af4)
Backported-from: dbus!307
2022-09-13 12:47:29 +01:00
Ralf Habacker
890f0e0fc6 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

(cherry picked from commit 30426b26e6)
Backported-from: dbus!287
2022-09-13 12:27:10 +01:00
Alex Richardson
6a5e212b39 dbus-sysdeps-util-unix.c: Avoid including sys/syslimits.h
This header is GCC specific header that on my system just contains
`#include_next <limits.h>`. FreeBSD also provides this header but it
contains a `#warning` that it should not be used. Replace the one use
with `#include <limit.h>` and drop the configure checks.

(cherry picked from commit a214ed824d)
Backported-from: dbus!280
2022-09-13 12:26:36 +01:00
Simon McVittie
2d36911fc3 Move release checklist to its own file
In other projects I've found that having a separate file that only
lists the release steps makes them easier to check.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 3758e5b164)
2022-09-13 12:26:33 +01:00
Simon McVittie
c8dd76206b test: Skip tests that involve switching uid if unable to do so
In a Linux user namespace, it is possible that we are uid 0 but are
unable to switch to some other uid like DBUS_USER or DBUS_TEST_USER,
because the other uid is not "mapped" in the user namespace, resulting
in setuid() or setresuid() failing with EINVAL "Invalid argument".
For example, it's easy for this to happen when running under the
bubblewrap tool.

Try to drop privileges in a child process, and skip the test if we
are unable to do so.

Resolves: dbus#407
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 8b08dd3264)
Backported-from: dbus!330
2022-09-13 12:26:24 +01:00
Simon McVittie
a54da99a06 sysdeps: Only open oom_score_adj read/write if we need to write it
If we're running in a sandbox, we might not have write access to
oom_score_adj. In the common case where we don't have any special
protection from the OOM-killer, we can detect that with only read
access, and skip the part where we open it for writing.

(We would also not have write access to oom_score_adj if we're running
with elevated Linux capabilities while not root, but that should never
actually happen for dbus-daemon-launch-helper, which is setuid root
for production use or has no capabilities during unit-testing.)

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit a8006841ce)
Backported-from: dbus!291
2022-09-13 12:26:20 +01:00
Simon McVittie
aacd468108 activation-helper: Never crash if unable to write oom_score_adj
_dbus_warn() normally only logs a warning, but can be made fatal by
environment variables. In particular, we do that during unit testing,
which can result in a build-time test failure if dbus is built in a
sandbox environment that prevents write access.

_dbus_log() does only the logging part of _dbus_warn(), which seems
more appropriate here.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit ad72e3b9e3)
Backported-from: dbus!291
2022-09-13 12:26:13 +01:00
Simon McVittie
434ac5fdb3 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>
(cherry picked from commit 789d97ad53)
2022-09-13 12:26:07 +01:00
Alex Richardson
6d7ec5fc6d 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.

(cherry picked from commit 56e52a4212)
Backported-from: dbus!320
2022-09-13 12:25:54 +01:00
Jan Tojnar
6625f220c4 build: Do not dist built XML catalog
It will have whatever paths the person who built the dist tarball hardcoded.

(cherry picked from commit dcd19cc0d9)
Backported-from: dbus!317
2022-09-13 12:25:40 +01:00
Alex Richardson
9cf3b0810f 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.

(cherry picked from commit b932c343c4)
Backported-from: dbus!306
2022-09-13 12:24:56 +01:00
Jan Tojnar
9e8fe0718c 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

(cherry picked from commit b551b3e973)
Backported-from: dbus!302
2022-09-13 12:24:49 +01:00
Alex Richardson
3533087ea4 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.

(cherry picked from commit f4876e7cb5)
Backported-from: dbus!297
2022-09-13 12:24:43 +01:00
Alex Richardson
1c08115609 Fix no-X11 build after d847b5f6ae
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
(cherry picked from commit 6c1c7e539f)
Backported-from: dbus!298
2022-09-13 12:24:35 +01:00
Simon McVittie
e2dd13d906 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>
(cherry picked from commit 104df89947)
Backported-from: dbus!191
2022-09-13 12:24:24 +01:00
Mike Gilbert
d5f9a6e075 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>
(cherry picked from commit 769a0462be)
Backported-from: dbus!285
2022-09-13 12:24:13 +01:00
Alex Richardson
0d3ca74340 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.

(cherry picked from commit e827309976)
Backported-from: dbus!279
2022-09-13 12:24:07 +01:00
Alex Richardson
ce73955aad cmake: Use -Wl,-export_dynamic when building for macOS
The macOS linker does not accept --export-dynamic, so use this
alternate spelling.

(cherry picked from commit c7f6d07252)
Backported-from: dbus!278
2022-09-13 12:24:05 +01:00
Alex Richardson
41d2026fbd 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.

(cherry picked from commit 1a8fd7a382)
Backported-from: dbus!278
2022-09-13 12:23:56 +01:00
Alex Richardson
8c05bdc586 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.

(cherry picked from commit be5da7305e)
Backported-from: dbus!282
2022-09-13 12:23:50 +01:00
Alex Richardson
42b8ac2ba0 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).

(cherry picked from commit 3f5bdf0c2d)
Backported-from: dbus!281
2022-09-13 12:23:44 +01:00
Alex Richardson
83325d29ad 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 e8b34b419e.

(cherry picked from commit d4dbde9fc5)
Backported-from: dbus!277
2022-09-13 12:23:36 +01:00
Ralf Habacker
b745747f52 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"
(cherry picked from commit 6c21072a1e)
Backported-from: dbus!267
2022-09-13 12:23:24 +01:00
Ralf Habacker
29631357ac 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>
(cherry picked from commit d74fee2727)
Backported-from: dbus!266
2022-09-13 12:23:16 +01:00
Simon McVittie
052a2bead8 bus: Show the errno if inotify cannot be initialized
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 25e22b2540)
Backported-from: dbus!235
2022-09-13 12:23:13 +01:00
Simon McVittie
73240b300e bus: Correct check for inotify_init() failure
fd 0 is a valid fd - although if we are using stdin as our inotify fd,
something is weird somewhere.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 7e61e0b53b)
Backported-from: dbus!235
2022-09-13 12:22:46 +01:00
Simon McVittie
b03893726a Merge branch '1.14.x-ci' into 'dbus-1.14'
Fix CI on 1.14.x branch

See merge request dbus/dbus!337
2022-09-12 20:18:32 +00:00
Simon McVittie
8aa34131dd CI: Don't pin msys2 packages to a specific version at all
Similar to dbus/dbus!286, but more so: just use the package names,
ignoring their version numbers completely.

pcre2 is not strictly needed at the moment, but it'll be a dependency
for GLib >= 2.73.x (older versions used pcre). For a bit of
future-proofing, download both pcre and pcre2.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-12 20:06:46 +01:00
Ralf Habacker
067733d4b0 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>
2022-09-12 17:58:03 +01:00
Ralf Habacker
85f5f05038 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>
2022-09-12 17:57:50 +01:00
Ralf Habacker
7e9d3708b1 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>
2022-09-12 17:57:46 +01:00
Simon McVittie
7d462fe938 Merge branch '1.14-with-x' into 'dbus-1.14'
[1.14] Backport dbus!263

See merge request dbus/dbus!264
2022-03-01 19:01:22 +00:00
Simon McVittie
8c4cc34f04 Update NEWS with dbus!263
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-03-01 18:45:03 +00:00
Lars Wendler
62361f47f9 Convert "if" calls to AS_IF macro for the block that handles X11
(cherry picked from commit c71f013a64)
2022-03-01 18:40:51 +00:00
Lars Wendler
e03554eb0b Add have_x11=no if --without-x was given to make later checks happy
(cherry picked from commit bf3cb42c6d)
2022-03-01 18:40:48 +00:00
Lars Wendler
5dad12f34c Emit an error when --with-x was given but no X11 libs were found
(cherry picked from commit 17c88a8944)
2022-03-01 18:40:46 +00:00
Lars Wendler
5f2577aea3 Move DBUS_X_* definitions into PKG_CHECK_MODULES block
(cherry picked from commit 51e468d828)
2022-03-01 18:40:39 +00:00
Lars Wendler
fdbb32bd1f build: Treat --with-x[=yes] the same as --with-x=auto
Previously, --with-x would disable the check for X11 libraries, which
was not intended.

(cherry picked from commit 99cc28e0eb)
2022-03-01 18:40:36 +00:00
Simon McVittie
c169d863f9 Post-release version bump for 1.14.x
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-28 18:19:08 +00:00
Simon McVittie
6fd1509ba3 Prepare v1.14.0
Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/350
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-28 11:43:32 +00:00
Simon McVittie
428f60e8b2 spec: Go back to v0.38
Nothing changed in v0.39 yet, and it would be confusing to have the
version uploaded alongside dbus 1.14.0 say "not yet finalized".

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-28 11:23:39 +00:00
Simon McVittie
fce6a676d9 Revert "Disable MSVC CI by default for now"
This reverts commit 254b17977e.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-28 11:22:35 +00:00
Simon McVittie
90a2d9d948 Update AUTHORS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-28 11:15:32 +00:00
Ralf Habacker
c8ca3ecebc Merge branch 'doc_dbus-api-design_link_fixes' into 'master'
doc/dbus-api-design: fix broken links

See merge request dbus/dbus!257
2022-02-28 08:16:17 +00:00
Michael Nosthoff
bed735b493 doc/dbus-api-design: fix broken links
* use version independent qtdbus url
* developer.gnome.org links moved to developer-old.gnome.org
* bustle now on freedesktop gitlab
2022-02-28 08:01:34 +00:00
Ralf Habacker
fc92ceada7 Merge branch 'mingw-w64-printf' into 'master'
build: Opt out from using mingw-w64's replacement printf(), etc.

Closes #380

See merge request dbus/dbus!261
2022-02-28 07:47:19 +00:00