Commit graph

6849 commits

Author SHA1 Message Date
Simon McVittie
1932afdc38 Merge branch 'remove-autotools-support' into 'master'
Remove autotools build support

Closes #443

See merge request dbus/dbus!378
2023-09-01 16:06:10 +00:00
Ralf Habacker
4afcc80544 README,INSTALL: remove references to the autotools build system 2023-09-01 14:05:08 +00:00
Ralf Habacker
aab6e74794 .gitignore: remove autotools related files and pattern 2023-09-01 14:05:08 +00:00
Ralf Habacker
8ea959b24e Remove autotools related files 2023-09-01 14:05:08 +00:00
Ralf Habacker
ff80051410 Remove autotools support from CI jobs
The 'debian mingw32 autotools debug' job was replaced with a corresponding
meson related job named 'debian mingw32 meson debug' and the remaining
autotools related jobs were removed.

The drop in replacement job for 'debian mingw64 autotools' is
'debian mingw32 meson' and is now build by default.
2023-09-01 14:05:08 +00:00
Simon McVittie
0a90d29583 Merge branch 'fix-y2038' into 'master'
time: use dbus_int64_t for seconds instead of long

See merge request dbus/dbus!444
2023-08-24 13:13:37 +00:00
Alexander Kanavin
4c658af0b8 time: use dbus_int64_t for seconds instead of long
On 32 bit systems long will overflow in 2038, causing complete breakage.
This is confirmed by running dbus's test suite on a 32 bit system
with system time set to 2040 (and configured to use 64 bit time_t of course).

Note that both timespec and timeval are specified with time_t for the
seconds component. This should propagate everywhere where that data is
passed and stored, but previously _dbus_get_monotonic_time() and
_dbus_get_monotonic_time() would truncate it to long.

Also add a function for parsing dbus_int64_t from
files, as existing functions can only handle long.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
2023-08-23 14:42:05 +02:00
Simon McVittie
67a7ee7792 Start 1.15.10 development
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-21 20:53:07 +01:00
Simon McVittie
c4c868a84b Prepare v1.15.8
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-21 18:19:44 +01:00
Simon McVittie
a7fbf3f049 AUTHORS: Update
Automated change:

    ninja -C ${builddir} maintainer-update-authors

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-21 18:19:44 +01:00
Simon McVittie
ee03ffc898 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-21 17:55:00 +01:00
Simon McVittie
39d64f70a3 Merge branch 'issue343-3' into 'master'
sysdeps: Improve error reporting for looking up a user

See merge request dbus/dbus!442
2023-08-21 16:50:06 +00:00
Simon McVittie
6f6f861a3a userdb: Use "goto out" pattern for _dbus_groups_from_uid()
This makes it easier to verify that _dbus_user_database_unlock_system()
is called on all exit paths. The only early-return is when locking the
userdb failed.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-21 13:49:31 +00:00
Simon McVittie
8de818153b sysdeps: Improve error reporting for looking up a user
Our implementation always assumed that both code paths set errno, but
according to their API documentation, getpwnam_r and getpwuid_r actually
don't: they *return* a code from the same pseudo-enum as errno. They
also return 0 (but with a NULL struct passwd) if the user is not found,
which these APIs don't count as an error (but we do).

Similarly, in the legacy getpwnam/getpwuid code path, it is unspecified
whether looking up a nonexistent user will set errno or not.

Having retrieved an errno-like error code, we might as well use it in
the human-readable message and not just the machine-readable code,
because the human-readable message is what ends up in the system log.

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/343
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-21 13:49:31 +00:00
Simon McVittie
12b367daaa sysdeps: Give a more useful error if unable to resolve a numeric uid
If we want to get the struct passwd corresponding to uid 42, but we
can't, it's much better to say

    User ID "42" unknown

rather than

    User "???" unknown

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/343
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-21 13:49:31 +00:00
Simon McVittie
80b90e570e sysdeps-unix: Deduplicate error handling for getpwnam and getpwnam_r
The only difference between these was that we only needed to allocate
and free buf in the getpwnam_r case. We expect that all reasonable
Unix platforms will have getpwnam_r (it's in POSIX) so adding a no-op
dbus_free(NULL) to the getpwnam code path seems harmless.

This will be helpful when we make the error handling better, in a
subsequent commit.

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/343
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-21 13:49:31 +00:00
Simon McVittie
672f05e5f3 Merge branch 'issue473' into 'master'
bus: Don't crash if inotify fails, even under DBUS_FATAL_WARNINGS=1

Closes #473

See merge request dbus/dbus!441
2023-08-21 13:49:14 +00:00
Simon McVittie
62692cd7e7 bus: Don't crash if inotify fails, even under DBUS_FATAL_WARNINGS=1
When running tests, we use DBUS_FATAL_WARNINGS=1 to make the tests fail
on internal errors. Failing to set up inotify is not really an internal
error: it's more like an environmental error, which can occur for
reasons outside our control.

Instead, log using bus_context_log(), which never crashes the process
and always just logs a warning.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/473
2023-08-18 18:56:59 +00:00
Simon McVittie
01e65daa6a Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-18 19:55:59 +01:00
Simon McVittie
01757e0dd0 Merge branch 'issue343' into 'master'
Fix error behaviour on reload if a connection has an unknown uid

See merge request dbus/dbus!417
2023-08-18 18:33:55 +00:00
Simon McVittie
02b913f36c bus: When failing to reload client policy, continue iteration
If we have a large number of connections to the bus, and we fail to
reload the policy for one of them (perhaps because its uid no longer
exists in the system user database), previously we would crash, which
is obviously unintended. After the previous commit, we would stop
iteration through the list of client connections, which doesn't seem
great either: one bad connection shouldn't prevent us from reloading
the rest of our state.

Instead, let's distinguish between new connections (where we want
failure to establish a security policy to be fatal), and pre-existing
connections (where the current security policy is presumably good
enough to keep using if we have nothing better). If we're unable to
reload the policy for a pre-existing connection, log a warning and
carry on iterating.

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/343
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-18 18:51:12 +01:00
Simon McVittie
9bac14973d test: Add a targeted test for _dbus_unix_groups_from_uid()
Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/343
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-18 18:51:08 +01:00
Simon McVittie
980e52898b userdb: Add proper error reporting when getting groups from a uid
Previously, if dbus_connection_get_unix_user() succeeded but
_dbus_unix_groups_from_uid() failed, then bus_connection_get_unix_groups()
would incorrectly fail without setting the error indicator, resulting
in "(null)" being logged, which is rather unhelpful.

This also lets us distinguish between ENOMEM and other errors, such as
the uid not existing in the system's user database.

Fixes: 145fb99b (untitled refactoring commit, 2006-12-12)
Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/343
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-18 16:04:03 +01:00
Simon McVittie
73093fb3bc Merge branch 'issue343-minimal' into 'master'
bus: Don't crash if bus_context_create_client_policy() fails

Closes #343

See merge request dbus/dbus!435
2023-08-18 14:55:32 +00:00
Peter Benie
63522f2887 bus: Don't crash if bus_context_create_client_policy() fails
If policy creation fails, we can't usefully leave a NULL policy in the
BusConnectionData. If we did, the next attempt to reload policy would
crash with a NULL dereference when we tried to unref it, or with
an assertion failure.

One situation in which we can legitimately fail to create a client policy
is an out-of-memory condition. Another is if we are unable to look up a
connection's supplementary groups with SO_PEERGROUPS, and also unable to
look up the connection's uid's groups in the system user database, for
example because it belongs to a user account that has been deleted (which
is sysadmin error, but can happen, particularly in automated test systems)
or because a service required by a Name Service Switch plugin has failed.

Keeping the last known policy is consistent with what happens to all
the connections that are after this one in iteration order: after we
early-return, all of those connections retain their previous policies
(which doesn't seem ideal either, but that's how this has always worked).

[smcv: Add commit message]
Co-authored-by: Simon McVittie <smcv@collabora.com>
Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/343
2023-08-16 11:26:10 +01:00
Simon McVittie
3378792746 Update NEWS 2023-08-15 15:45:54 +01:00
Simon McVittie
b54af72dfd Add REUSE copyright/license information for binary message blobs
Most of these binary blobs is mechanically derived from the
corresponding .hex file, which is hand-written.

boolean-has-no-value.message-raw is presumably either hand-constructed
or fuzzer-generated: it was committed by a Red Hat employee and never
altered, so I've assumed Red Hat is the copyright holder. Permission
was already granted by Red Hat to relicense their dbus contributions
under the MIT (Expat) license.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-15 15:41:17 +01:00
Simon McVittie
1b329c31ba subprojects: Move SPDX information from inline to .reuse/dep5
This makes updates with `meson wrap update` more straightforward.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-15 15:41:17 +01:00
Simon McVittie
6ed4284f14 Merge branch 'issue439' into 'master'
meson: Specify that build-machine compiler for C++ is not required

Closes #439

See merge request dbus/dbus!432
2023-08-15 14:27:34 +00:00
Simon McVittie
3d0ee109c3 meson: Specify that build-machine compiler for C++ is not required
When cross-compiling Windows binaries on (for example) Linux, we only
need a Windows C++ compiler and not a Linux C++ compiler.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/439
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-15 13:55:12 +00:00
Simon McVittie
3365c95c20 Merge branch 'stdatomic' into 'master'
sysdeps: Use C11 stdatomic.h where possible

See merge request dbus/dbus!431
2023-08-15 13:34:10 +00:00
Simon McVittie
88b5749984 sysdeps: Use C11 stdatomic.h where possible
On Unix, dbus has historically used gcc-specific lock-free atomic
intrinsics where available, falling back to a pthreads mutex where
possible. Meanwhile, on Windows, it has historically used
InterlockedIncrement() and similar library functions (in practice
wrappers around lock-free intrinsics on real Windows, but IPC calls into
wineserver on Wine).

ISO C11 provides a new header, stdatomic.h, with standardized support
for atomic operations. Exactly how these are implemented is a compiler
quality-of-implementation decision, but any reasonable compiler
implementation on a modern CPU should be using intrinsics. Let's use
this wherever possible, falling back to our old implementation only if
the C11 implementation is unsupported.

One concrete benefit that we get from this is that when compiling with
mingw-w64 gcc and running via Wine, this makes atomic reference counting
operations into a simple local operation, rather than IPC to wineserver
which can be very slow. This should make our CI tests considerably more
reliable.

In all vaguely modern gcc versions (gcc 5.5 or later) and in contemporary
versions of clang, the default compiler mode is C11 or later with GNU
extensions. We intentionally do not ask for any specific C standard, so
we can use C11 features like this one, as long as we do so conditionally.

The Microsoft Visual C compiler does not currently support this without
special options, so we still use the Interlocked family of functions
when compiling for Windows with MSVC.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-15 12:54:41 +00:00
Simon McVittie
e621e99241 sysdeps: Move declarations used from C++ to their own header
I want to use <stdatomic.h> in dbus-sysdeps.h, but if we do that, we
won't be able to include that header into C++ code on all compilers.
Move the declarations for new internal Windows-specific functions
introduced in commit 17a23d08
"dbus_threads_init_default, dbus_threads_init: be safe to call at any time"
into their own header.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-15 12:54:41 +00:00
Simon McVittie
dbe7de00ae Merge branch 'as-installed' into 'master'
CI: Run "as-installed" tests with Meson, not just Autotools

Closes #436 and #470

See merge request dbus/dbus!425
2023-08-15 12:27:52 +00:00
Simon McVittie
3e4dd491bb CI: Install systemd system and user units into our ${prefix}
This keeps everything we install from CI separate from a possible
OS-level installation in /usr.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/470
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-15 12:14:57 +00:00
Simon McVittie
4b4aa24919 CI: Run "as-installed" tests with Meson, not just Autotools
Otherwise, we'd lose this test coverage when we remove Autotools.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/436
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-15 12:14:57 +00:00
Simon McVittie
14c1dcd322 meson: Allow sudo meson install, which doesn't set DESTDIR
This is generally not recommended (dbus should usually be installed from
the OS distributor's packages, which should install into a staging
directory using `DESTDIR`), but we'll want to use it in Gitlab-CI.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-15 12:14:57 +00:00
Simon McVittie
dd5fdcacf7 INSTALL: Add some sub-headings for non-Meson build systems
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-15 13:10:37 +01:00
Ralf Habacker
041b236251 INSTALL: Re-word CMake build instructions
Originally part of commit
"README,INSTALL: remove references to the autotools build system"
in dbus!378.

Co-authored-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-15 13:09:56 +01:00
Simon McVittie
4325a0fcc8 Continue to recommend CMake when building on Windows
In the longer term I'd like to move everything towards Meson so we only
have one primary build system, but at the moment Ralf would prefer to
keep recommending CMake for Windows builds (see dbus!378) so let's
stick with that for now.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-15 13:06:18 +01:00
Simon McVittie
0b685497a0 Merge branch 'spdx-mit' into 'master'
Add SPDX license tags for the MIT (Expat) license, where straightforward

See merge request dbus/dbus!427
2023-08-15 11:22:54 +00:00
Simon McVittie
3190b488e3 Add SPDX license tags for the MIT (Expat) license, where straightforward
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-14 17:18:04 +00:00
Simon McVittie
680ba5d4a7 Merge branch 'meson-special-builds' into 'master'
Use Meson for the 'reduced' and 'legacy' build variants

See merge request dbus/dbus!430
2023-08-14 17:17:29 +00:00
Ralf Habacker
5d1922784c Use Meson for the 'reduced' and 'legacy' build variants
There are some differences between Autotools and Meson here:

- Because we detect native atomic operations differently, we can no
  longer emulate a platform that doesn't have them, such as ARMv4;
  but modern OSs no longer support ARMv4 and all significant hardware
  platforms now have native atomic operations, so this is now less of
  a concern.

- Similarly, we can no longer emulate a platform that doesn't have the
  getrandom() library function, but that function is available in all
  relevant glibc versions (such as CentOS >= 8, Debian >= 10,
  Ubuntu >= 18.04) so testing the fallback path is less of a concern now.

We also no longer try to disable dnotify in the legacy build, but our
dnotify code path was removed in 2013, so --disable-dnotify didn't do
anything anyway.

[Separated from a larger commit on dbus!378 —smcv]

Co-authored-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-14 17:38:17 +01:00
Simon McVittie
6fb74c76ee Merge branch 'spdx-misc' into 'master'
Improve SPDX license info slightly

See merge request dbus/dbus!428
2023-08-14 16:21:35 +00:00
Simon McVittie
b463b301b9 stats.h: Add missing copyright information
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-14 16:58:22 +01:00
Simon McVittie
7c4d0d6281 doc: Repeat a copyright notice in a form understood by SPDX tools
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-14 16:58:21 +01:00
Simon McVittie
ad44d655ba NEWS: Update
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-14 16:29:47 +01:00
Simon McVittie
1999ea0537 INSTALL: Rewrite extremely outdated list of dependencies
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-14 16:29:46 +01:00
Simon McVittie
24c4b60a59 release-checklist: Update for increased use of Meson
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-14 16:18:58 +01:00