]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
6 months agotree-wide: Sort includes 37278/head
Daan De Meyer [Mon, 28 Apr 2025 13:08:57 +0000 (15:08 +0200)] 
tree-wide: Sort includes

This was done by running a locally built clang-format with
https://github.com/llvm/llvm-project/pull/137617 and
https://github.com/llvm/llvm-project/pull/137840 applied on all .c
and .h files.

6 months agoclang-format: Disable for src/basic/include/linux
Daan De Meyer [Wed, 30 Apr 2025 07:21:55 +0000 (09:21 +0200)] 
clang-format: Disable for src/basic/include/linux

We shouldn't try to format these headers, so add a custom .clang-format
that disables formatting for the directory.

6 months agoclang-format: Add include sorting directives
Daan De Meyer [Mon, 28 Apr 2025 12:17:05 +0000 (14:17 +0200)] 
clang-format: Add include sorting directives

Let's make sure clang-format sorts includes according to our style
guide.

6 months agoresolve: Remove unnecessary ENABLE_DNS_OVER_TLS check
Daan De Meyer [Wed, 30 Apr 2025 07:30:14 +0000 (09:30 +0200)] 
resolve: Remove unnecessary ENABLE_DNS_OVER_TLS check

6 months agobasic: Remove assertions from missing_fs.h
Daan De Meyer [Tue, 29 Apr 2025 13:46:48 +0000 (15:46 +0200)] 
basic: Remove assertions from missing_fs.h

These assertions impose an include order between <linux/fs.h> and
"missing_fs.h", specifically <linux/fs.h> can't be included before
"missing_fs.h". This makes automated include refactoring very painful,
so let's get rid of these assertions and instead assume that linux/fs.h
does the right thing.

6 months agobasic: Add macro.h include to missing_syscall_def.h
Daan De Meyer [Tue, 29 Apr 2025 13:46:15 +0000 (15:46 +0200)] 
basic: Add macro.h include to missing_syscall_def.h

Required for assert_cc()

6 months agobasic: Add our own <netinet/in.h> and <net/if.h> headers
Daan De Meyer [Tue, 29 Apr 2025 13:20:02 +0000 (15:20 +0200)] 
basic: Add our own <netinet/in.h> and <net/if.h> headers

These glibc headers conflicts with the corresponding linux headers
(<linux/in.h> and <linux/if.h>) and impose an include order (the glibc one
has to be included before any linux header is included). This makes sorting
includes a royal pain so let's define our own versions of these headers using
various linux headers to do all the work and filling in the missing bits
ourselves.

6 months agotree-wide: drop unnecessary inclusion of tmpfile-util.h
Yu Watanabe [Tue, 29 Apr 2025 19:46:44 +0000 (04:46 +0900)] 
tree-wide: drop unnecessary inclusion of tmpfile-util.h

6 months agoudev: Enable delegation without delegating any controllers
Daan De Meyer [Fri, 25 Apr 2025 07:36:30 +0000 (09:36 +0200)] 
udev: Enable delegation without delegating any controllers

Delegation is enabled for udev so that it can mess around with the
cgroup hierarchy to avoid killing control processes when it calls
cg_kill in on_post() when it goes idle. We don't actually care about
any specific cgroup controllers in udev, so set Delegate= to enable
delegation without delegating any controllers

Follow up for https://github.com/systemd/systemd/pull/22752

6 months agoudev: Make Storage Tests Stable Again ! (#37262)
Luca Boccassi [Tue, 29 Apr 2025 13:37:20 +0000 (14:37 +0100)] 
udev: Make Storage Tests Stable Again ! (#37262)

6 months agovarious: do not use assert_se as a workaround in non-test code
Zbigniew JÄ™drzejewski-Szmek [Tue, 29 Apr 2025 10:49:54 +0000 (12:49 +0200)] 
various: do not use assert_se as a workaround in non-test code

This partially reverts 5332be60d3897c7b86d28cf7b9d61c5dc6847fd6. I expect that
there is no practical difference, but it seems philosophically wrong to use
assert_se(), i.e. for the generation of the code in non-debug builds, just to
suppress a warning. We have _unused_ for that, use it.

I verified that we don't get warnings with clang and -DNDEBUG=1 with this patch.

6 months agobasic/include/linux: update kernel headers from v6.15-rc4
Yu Watanabe [Mon, 28 Apr 2025 06:50:09 +0000 (15:50 +0900)] 
basic/include/linux: update kernel headers from v6.15-rc4

6 months agocleanup: update bug prone argument comments (#37281)
Daan De Meyer [Tue, 29 Apr 2025 12:34:37 +0000 (14:34 +0200)] 
cleanup: update bug prone argument comments (#37281)

@DaanDeMeyer Obviously this doesn't fix nearly everything, so gradually
moving things over is probably a smart thing? It seems clang-tidy does
support drop in configs for example:

```
# SPDX-License-Identifier: LGPL-2.1-or-later
---
Checks: '
    -*,
    bugprone-argument-comment
'
WarningsAsErrors: '*'
```

Its a bit strange that `WarningsAsErrors` isn't propagated, but dropping
this file in src/report/.clang-tiday invokes:

```
[1314/1543][1.5s] /usr/bin/clang-tidy --use-color -extra-arg=-fno-caret-diagnostics -p=/home/jelle/projects/systemd/build -quiet /home/jelle/projec
ts/systemd/src/repart/repart.c
../src/repart/repart.c:4715:41: error: argument name 'pubkey' in comment does not match parameter name 'public' [bugprone-argument-comment,-warning
s-as-errors]
 4715 |                                         /* pubkey= */ NULL,      /* Turn this one off for the 2nd shard */
      |                                         ^
../src/shared/tpm2-util.h:281:108: note: 'public' declared here
  281 | int tpm2_calculate_sealing_policy(const Tpm2PCRValue *pcr_values, size_t n_pcr_values, const TPM2B_PUBLIC *public, bool use_pin, const Tpm2
PCRLockPolicy *policy, TPM2B_DIGEST *digest);
      |                                                                                                            ^
```

So that seems to behave as intended :)

And in some cases I am not sure if switching to the correct argument is
an improvement ie.:
```
../src/bootctl/bootctl-reboot-to-firmware.c:66:51: [38;2;190;132;255m0;1;31merror: argument name 'dispatch_table' in comment does not match paramet
er name 'table' [bugprone-argument-comment,-warnings-as-errors]
   66 |         r = sd_varlink_dispatch(link, parameters, /* dispatch_table = */ NULL, /* userdata = */ NULL);
      | [38;2;190;132;255m0;1;32m                                                  ^
../src/systemd/sd-varlink.h:187:98: [38;2;190;132;255m0;1;36mnote: 'table' declared here
  187 | int sd_varlink_dispatch(sd_varlink *v, sd_json_variant *parameters, const sd_json_dispatch_field table[], void *userdata);
      | [38;2;190;132;255m0;1;32m                                                                                                 ^
```

or
```
../src/validatefs/validatefs.c:274:83: [38;2;190;132;255m0;1;31merror: argument name 'ret_len' in comment does not match parameter name 'len' [bugprone-argument-comment,-warnings-as-errors]
  274 |                         (void) blkid_probe_lookup_value(b, "PART_ENTRY_TYPE", &v, /* ret_len= */ NULL);
      | [38;2;190;132;255m0;1;32m                                                                                  ^
/usr/include/blkid/blkid.h:455:52: [38;2;190;132;255m0;1;36mnote: 'len' declared here
  455 |                         const char **data, size_t *len)
      | [38;2;190;132;255m0;1;32m                                                   ^
```

But that's also half a style thing with `len` winning over `ret_len`.

6 months agopo: Translated using Weblate (Arabic)
joo es [Mon, 28 Apr 2025 17:31:58 +0000 (17:31 +0000)] 
po: Translated using Weblate (Arabic)

Currently translated at 100.0% (257 of 257 strings)

po: Translated using Weblate (Arabic)

Currently translated at 93.7% (241 of 257 strings)

Co-authored-by: joo es <johndevand@tutanota.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ar/
Translation: systemd/main

6 months agobasic/time-util: fix error handling of clock_nanosleep()
David Rheinsberg [Mon, 28 Apr 2025 11:13:10 +0000 (13:13 +0200)] 
basic/time-util: fix error handling of clock_nanosleep()

`clock_nanosleep()` returns error codes directly, rather than using
`errno`. Ensure that we use those codes, rather than checking for `<0`.

6 months agossh-generator: update argument comments 37281/head
Jelle van der Waa [Mon, 28 Apr 2025 15:20:13 +0000 (17:20 +0200)] 
ssh-generator: update argument comments

6 months agonetwork: update argument comments
Jelle van der Waa [Mon, 28 Apr 2025 15:15:55 +0000 (17:15 +0200)] 
network: update argument comments

6 months agosocket-activate: various modernizations (#37267)
Mike Yuan [Mon, 28 Apr 2025 12:28:22 +0000 (14:28 +0200)] 
socket-activate: various modernizations (#37267)

6 months agopo: Translated using Weblate (Arabic)
joo es [Sun, 27 Apr 2025 21:59:36 +0000 (21:59 +0000)] 
po: Translated using Weblate (Arabic)

Currently translated at 50.1% (129 of 257 strings)

Co-authored-by: joo es <johndevand@tutanota.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ar/
Translation: systemd/main

6 months agosocket-activate: set up SIGCHLD handler only in --accept mode 37267/head
Mike Yuan [Sun, 27 Apr 2025 18:28:32 +0000 (20:28 +0200)] 
socket-activate: set up SIGCHLD handler only in --accept mode

6 months agosocket-activate: signal READY=1 once sockets are open for --accept mode
Mike Yuan [Sun, 27 Apr 2025 18:20:14 +0000 (20:20 +0200)] 
socket-activate: signal READY=1 once sockets are open for --accept mode

6 months agosocket-activate: clean up control flow a bit
Mike Yuan [Sun, 27 Apr 2025 18:08:31 +0000 (20:08 +0200)] 
socket-activate: clean up control flow a bit

6 months agosocket-activate: remove effectively unused 'name' param for exec_process()
Mike Yuan [Sun, 27 Apr 2025 18:05:40 +0000 (20:05 +0200)] 
socket-activate: remove effectively unused 'name' param for exec_process()

6 months agosocket-activate: drop arg_args
Mike Yuan [Sun, 27 Apr 2025 17:52:19 +0000 (19:52 +0200)] 
socket-activate: drop arg_args

To follow our usual coding style.

6 months agojournald-server: use generic NOTIFY_READY message
Mike Yuan [Sun, 27 Apr 2025 18:17:08 +0000 (20:17 +0200)] 
journald-server: use generic NOTIFY_READY message

6 months agoman/busctl: many other commands can take --json=/-j
Yu Watanabe [Sat, 26 Apr 2025 01:35:38 +0000 (10:35 +0900)] 
man/busctl: many other commands can take --json=/-j

Also, in a futre remaining commands may also support the option.
Let's not mention which command support the options.

Closes #37210.

6 months agotree-wide: fix typo
Yu Watanabe [Sun, 27 Apr 2025 01:35:52 +0000 (10:35 +0900)] 
tree-wide: fix typo

6 months agoudev: readjust priorities of event sources 37262/head
Yu Watanabe [Thu, 24 Apr 2025 04:59:07 +0000 (13:59 +0900)] 
udev: readjust priorities of event sources

Follow-up for 511619087b66baa52907d1f6c25e28ccb9590a5f.

Notable changes are
- SIGTERM is the highest among others, to make not udevd queue too
  many events, as we need to serialize them anyway.
- device monitor has the second highest priority, to make 'remove'
  uevents received earlier than IN_IGNORED inotify events. Otherwise,
  after IN_IGNORED is received, if there is no queued event,
  /run/udev/queue file will be removed by the post-event source of the
  inotify event, and 'udevadm settle' or friends may wrongly finish,
  even we will soon queue 'remove' uevents for the device.
  This change should fix the recent instability of TEST-64-UDEV-STORAGE.

For other changes, see the comments in the code.

6 months agoudev: do not remove /run/udev/queue file when we are synthesizing events
Yu Watanabe [Thu, 24 Apr 2025 03:53:29 +0000 (12:53 +0900)] 
udev: do not remove /run/udev/queue file when we are synthesizing events

Note, it should be safe even if we synthesize no event, e.g. when the
device has been already removed. In such case, the post event after
SIGCHLD will remove the file.

6 months agoudev: try again to create /run/udev/queue when queueing the next event
Yu Watanabe [Sat, 26 Apr 2025 06:53:48 +0000 (15:53 +0900)] 
udev: try again to create /run/udev/queue when queueing the next event

This is mostly a paranoia, but if we failed to create /run/udev/queue
for some reasons on queueing an event, previously we would never create
the file until once the queue became empty. This makes in such case we
try to create the file again when queueing the next event.

6 months agoman/sd_bus_slot_set_floating: Improve wording around b parameter
Jesper Nilsson [Sat, 26 Apr 2025 15:39:56 +0000 (17:39 +0200)] 
man/sd_bus_slot_set_floating: Improve wording around b parameter

6 months agoSeveral Coverity fixes (#37253)
Mike Yuan [Sat, 26 Apr 2025 14:58:54 +0000 (16:58 +0200)] 
Several Coverity fixes (#37253)

6 months agonetworkd: reduce the default IPv4 DAD (ACD) timeout and make it configurable (#37138)
Yu Watanabe [Sat, 26 Apr 2025 07:19:33 +0000 (16:19 +0900)] 
networkd: reduce the default IPv4 DAD (ACD) timeout and make it configurable (#37138)

RFC 5227 specifies randomized intervals to avoid that a large number of
hosts powered up at the same time send their message simultaneously.
Performing the conflict detection takes a variable time between 4 and 7
seconds from the beginning to the first announcement, as shown by the
following diagram where P indicates a probe and A an announcement:

```
     time(s)     0   1   2   3   4   5   6   7   8   9
                 +---+---+---+---+---+---+---+---+---+
     SHORTEST    P   P   P       A       A
     LONGEST         P       P       P       A       A
```

The host can't use the address until the first announcement is sent. 7
seconds is a very long time on modern computers especially considering
the fact that the round-trip time on current LAN technologies is at most
few milliseconds. Section 2.2 of the RFC addresses this matter and hints
that a future standard will adjust those timeouts; however that standard
doesn't exist yet.

Make the timeout configurable via a new
"IPv4DuplicateAddressDetectionTimeoutSec=" option. The intervals defined
in the RFC are then scaled proportionally so that the duration of the
conflict detection takes at most the given value. Interval happening
after the first announcement are not scaled, as recommended by the RFC.

Also reduce the default value from 7s to 200ms, which is a more suitable
value for today's technology.

6 months agonetworkd: reduce the IPv4 DAD timeout to 200ms 37138/head
Beniamino Galvani [Mon, 14 Apr 2025 20:37:26 +0000 (22:37 +0200)] 
networkd: reduce the IPv4 DAD timeout to 200ms

The original timeout of 7 seconds is very long for today's networks. Reduce it
to 200ms. Note that this change also affects IPv4 link-local addressing.

6 months agonetworkd: make the ACD timeout configurable
Beniamino Galvani [Mon, 14 Apr 2025 20:37:23 +0000 (22:37 +0200)] 
networkd: make the ACD timeout configurable

RFC 5227 specifies randomized intervals to avoid that a large number of hosts
powered up at the same time send their message simultaneously. Performing the
conflict detection takes a variable time between 4 and 7 seconds from the
beginning to the first announcement, as shown by the following diagram where P
indicates a probe and A an announcement:

 time(s)     0   1   2   3   4   5   6   7   8   9
             +---+---+---+---+---+---+---+---+---+
 SHORTEST    P   P   P       A       A
 LONGEST         P       P       P       A       A

The host can't use the address until the first announcement is sent. 7 seconds
is a very long time on modern computers especially considering the fact that
the round-trip time on current LAN technologies is at most few milliseconds.
Section 2.2 of the RFC addresses this matter and hints that a future standard
will adjust those timeouts; however that standard doesn't exist yet.

Make the timeout configurable via a new IPv4DuplicateAddressDetectionTimeoutSec=
option. The intervals defined in the RFC are then scaled proportionally so that
the duration of the conflict detection takes at most the given value. Interval
happening after the first announcement are not scaled, as recommended by the
RFC.

6 months agojournal-file: fix meaning less assertion 37253/head
Yu Watanabe [Sat, 26 Apr 2025 00:35:43 +0000 (09:35 +0900)] 
journal-file: fix meaning less assertion

Closes CID#1609495.

6 months agoformat-table: add _TABLE_ERSATZ_INVALID to follow our usual coding style
Yu Watanabe [Sat, 26 Apr 2025 00:32:18 +0000 (09:32 +0900)] 
format-table: add _TABLE_ERSATZ_INVALID to follow our usual coding style

Closes CID#1609497.

6 months agocore/device: fix meaningless assertion
Yu Watanabe [Sat, 26 Apr 2025 00:29:40 +0000 (09:29 +0900)] 
core/device: fix meaningless assertion

Closes CID#1609498.

6 months agopo: Translated using Weblate (Arabic)
joo es [Fri, 25 Apr 2025 12:44:03 +0000 (12:44 +0000)] 
po: Translated using Weblate (Arabic)

Currently translated at 28.0% (72 of 257 strings)

Co-authored-by: joo es <johndevand@tutanota.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ar/
Translation: systemd/main

6 months agoUpdate example to F42 and fix invocation with dnf5 (#37250)
Luca Boccassi [Fri, 25 Apr 2025 12:35:05 +0000 (13:35 +0100)] 
Update example to F42 and fix invocation with dnf5 (#37250)

6 months agoman: update fedora release to F42 37250/head
Zbigniew JÄ™drzejewski-Szmek [Fri, 25 Apr 2025 11:58:07 +0000 (13:58 +0200)] 
man: update fedora release to F42

F42 was released a few weeks ago.

6 months agoman/systemd-nspawn: call dnf with --use-host-config
Zbigniew JÄ™drzejewski-Szmek [Fri, 25 Apr 2025 11:56:22 +0000 (13:56 +0200)] 
man/systemd-nspawn: call dnf with --use-host-config

This is needed for dnf5. But dnf-4 doesn't know about it. So also add a hint to
skip the option with dnf-4. We can drop this later when dnf5 is the default
everywhere.

Also, s/vim-minimal/nano/. Nano is the default editor in Fedora since
https://fedoraproject.org/wiki/Changes/UseNanoByDefault.

6 months agopo: Added translation using Weblate (Arabic)
joo es [Fri, 25 Apr 2025 08:21:33 +0000 (08:21 +0000)] 
po: Added translation using Weblate (Arabic)

Co-authored-by: joo es <johndevand@tutanota.com>
6 months agodocs: Document manual cgroup controller management for Delegate=yes
Daan De Meyer [Thu, 24 Apr 2025 20:53:01 +0000 (22:53 +0200)] 
docs: Document manual cgroup controller management for Delegate=yes

This isn't immediately clear, so let's explicitly document this fact.

More context in https://github.com/systemd/systemd/issues/7355.

6 months agohwdb/keyboard: Map FN key on TUXEDO InfinityFlex 14 Gen1
Werner Sembach [Thu, 24 Apr 2025 21:29:53 +0000 (23:29 +0200)] 
hwdb/keyboard: Map FN key on TUXEDO InfinityFlex 14 Gen1

Map the FN key of TUXEDO InfinityFlex 14 Gen1 that wrongly produces the F23
scancode by default.

Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
6 months agoselinux: Disable selinux logging in mac_init() as well
Daan De Meyer [Wed, 23 Apr 2025 15:26:11 +0000 (17:26 +0200)] 
selinux: Disable selinux logging in mac_init() as well

We currently only disable selinux logging in mac_selinux_setup(),
but not in mac_init(). We don't want libraries we use to log unless
we tell them to, so disable selinux's logging in mac_init() as well.

6 months agoupdate TODO
Michal Koutný [Thu, 24 Apr 2025 14:59:09 +0000 (16:59 +0200)] 
update TODO

6 months agotest: use /run/ for test configuration, not /etc/
Luca Boccassi [Thu, 24 Apr 2025 14:29:56 +0000 (15:29 +0100)] 
test: use /run/ for test configuration, not /etc/

In case of failures we don't want to leave an image with intermediate
test configuration, as images are reused across multiple tests

Follow-up for edca63a63226705763c61811d1845aff5f073d59

6 months agotest: Add custom signal handlers to integration test wrapper script
Daan De Meyer [Thu, 24 Apr 2025 08:07:06 +0000 (10:07 +0200)] 
test: Add custom signal handlers to integration test wrapper script

meson will send SIGTERM if the test gets stuck and hits the timeout,
in which case we still want to do log saving and analysis, so let's
add some signal handlers which allow us to do that.

This won't be very useful until https://github.com/mesonbuild/meson/pull/14513
lands, since we only get half a second from meson to handle SIGTERM
before it sends SIGKILL, but let's land this already so we immediately
start taking advantage of the meson fix once it lands.

6 months agoSeveral cleanups for reading IP address from DBus message (#37230)
Yu Watanabe [Thu, 24 Apr 2025 21:07:18 +0000 (06:07 +0900)] 
Several cleanups for reading IP address from DBus message (#37230)

6 months agosd-json: fix conditions
Yu Watanabe [Thu, 24 Apr 2025 05:52:08 +0000 (14:52 +0900)] 
sd-json: fix conditions

Fixes a bug in 6647bbeab13fb115ecd0b389963001e978da1fce (v257).

Fixes CID#1609496.

6 months agoVarious clang-tidy improvements (#37237)
Daan De Meyer [Thu, 24 Apr 2025 12:40:39 +0000 (14:40 +0200)] 
Various clang-tidy improvements (#37237)

6 months agomeson: Implement duplicate includes check with clang-tidy 37237/head
Daan De Meyer [Thu, 24 Apr 2025 10:06:49 +0000 (12:06 +0200)] 
meson: Implement duplicate includes check with clang-tidy

Instead of doing this with our own script, let's use clang-tidy
instead.

6 months agonetwork: Remove duplicate include
Daan De Meyer [Thu, 24 Apr 2025 10:06:27 +0000 (12:06 +0200)] 
network: Remove duplicate include

6 months agomeson: Define our own clang-tidy target
Daan De Meyer [Thu, 24 Apr 2025 09:58:45 +0000 (11:58 +0200)] 
meson: Define our own clang-tidy target

meson's target has a few issues:
- Runs on all source files regardless if they're included in the
  build or not
- Doesn't have any dependencies on generated sources which means we
  have to do a full build first before we can run clang-tidy
- Doesn't allow us to pass any extra arguments

To work around these, let's define our own clang-tidy target instead
using llvm's run-clang-tidy script. Alongside the clang-tidy target,
let's start keeping track of all generated sources which we make the
clang-tidy target depend on. We also add a new target which will only
generate source files which is useful for setting up the source tree
for running code analysis against it.

6 months agoRemove unused code and fix one bug (#37225)
Yu Watanabe [Thu, 24 Apr 2025 03:28:48 +0000 (12:28 +0900)] 
Remove unused code and fix one bug (#37225)

6 months agotree-wide: Remove dead code 37225/head
Daan De Meyer [Wed, 23 Apr 2025 11:51:26 +0000 (13:51 +0200)] 
tree-wide: Remove dead code

This code seems to not be used anywhere at all, so let's drop it.

Follow up for ba8d00e859c82b8c1f31d515a48d9b56af1dc9ec
Follow up for 85686b37b098b5de4707776ad89598727bf7453f
Follow up for aff853f8ea29f22b28e3b584807893c528227769
Follow up for 36dad381a24e73e09a677df6daa48701f2dc7caa

6 months agocore: Use parse_syscall_archs() in bus_exec_context_set_transient_property()
Daan De Meyer [Wed, 23 Apr 2025 13:48:13 +0000 (15:48 +0200)] 
core: Use parse_syscall_archs() in bus_exec_context_set_transient_property()

6 months agonetwork: Fix wrong config parser for Bridge.MulticastIGMPVersion
Daan De Meyer [Wed, 23 Apr 2025 11:50:14 +0000 (13:50 +0200)] 
network: Fix wrong config parser for Bridge.MulticastIGMPVersion

Follow up for afa51e2dfb1a0171d3a9341e5a5fc5c4088624bc

6 months agocore/dbus-cgroup: use bus_message_read_in_addr_auto() at one more place 37230/head
Yu Watanabe [Thu, 24 Apr 2025 01:00:36 +0000 (10:00 +0900)] 
core/dbus-cgroup: use bus_message_read_in_addr_auto() at one more place

6 months agobus-message-util: use bus_message_read_family() at one more place
Daan De Meyer [Wed, 23 Apr 2025 13:43:43 +0000 (15:43 +0200)] 
bus-message-util: use bus_message_read_family() at one more place

6 months agoresolvectl: skip reading remaining elements when an invalid address is specified
Yu Watanabe [Thu, 24 Apr 2025 00:49:50 +0000 (09:49 +0900)] 
resolvectl: skip reading remaining elements when an invalid address is specified

Previous code assumed that both family and address are read when
-EINVAL, hence the following read of port and name could succeed.

Let's drop the assumption, and skip reading remaining elements.

No functional change, just refactoring and preparation for later change.

6 months agoresolvectl: make three booleans for read_dns_server_one() into one enum
Yu Watanabe [Thu, 24 Apr 2025 00:22:43 +0000 (09:22 +0900)] 
resolvectl: make three booleans for read_dns_server_one() into one enum

6 months agorepart: Allow devices as sources for --copy-from
Nick Labich [Tue, 22 Apr 2025 00:03:46 +0000 (20:03 -0400)] 
repart: Allow devices as sources for --copy-from

Implements #37208

6 months agoudev: support soft-reboot (#37222)
Yu Watanabe [Thu, 24 Apr 2025 00:31:56 +0000 (09:31 +0900)] 
udev: support soft-reboot (#37222)

6 months agomkosi: Run clangd within the tools tree instead of the build container
Daan De Meyer [Wed, 23 Apr 2025 15:31:20 +0000 (17:31 +0200)] 
mkosi: Run clangd within the tools tree instead of the build container

Running within the build sandbox has a number of disadvantages:
- We have a separate clangd cache for each distribution/release combo
- It requires to build the full image before clangd can be used
- It breaks every time the image becomes out of date and requires a
  rebuild
- We can't look at system headers as we don't have the knowledge to map
  them from inside the build sandbox to the corresponding path on the host

Instead, let's have mkosi.clangd run clangd within the tools tree. We
already require building systemd for both the host and the target anyway,
and all the dependencies to build systemd are installed in the tools tree
already for that, as well as clangd since it's installed together with the
other clang tooling we install in the tools tree. Unlike the previous approach,
this approach only requires the mkosi tools tree to be built upfront, which has
a much higher chance of not invalidating its cache. We can also trivially map
system header lookups from within the sandbox to the path within mkosi.tools
on the host so that starts working as well.

6 months agoAdd clang-tidy check in CI (#37226)
Daan De Meyer [Wed, 23 Apr 2025 14:43:17 +0000 (16:43 +0200)] 
Add clang-tidy check in CI (#37226)

This will make sure we keep our headers standalone and don't introduce
any new cyclic header dependencies

6 months agoci: Add basic clang-tidy check to linter workflow 37226/head
Daan De Meyer [Wed, 23 Apr 2025 13:21:11 +0000 (15:21 +0200)] 
ci: Add basic clang-tidy check to linter workflow

Let's add a basic clang-tidy check to the linter workflow. This
gives us the following:
- A check so that we don't introduce any new cyclic header dependencies
- A check to make sure all of our header files are standalone, as clang-tidy
  will fail to parse header files that don't include all their dependencies.

6 months agoVarious logging improvements and cleanups (#37040)
Daan De Meyer [Wed, 23 Apr 2025 13:31:44 +0000 (15:31 +0200)] 
Various logging improvements and cleanups (#37040)

6 months agoci: Use mkosi in linter workflow
Daan De Meyer [Wed, 23 Apr 2025 13:17:33 +0000 (15:17 +0200)] 
ci: Use mkosi in linter workflow

Let's reuse the mkosi tools tree to get all the tools we need instead
of pulling them from pypi.

6 months agoAdd .clangd configuration file that disables the unused include check
Daan De Meyer [Wed, 23 Apr 2025 13:26:39 +0000 (15:26 +0200)] 
Add .clangd configuration file that disables the unused include check

The clangd include checker is rather broken and is littered with false
positives in our codebase, so let's disable the feature until it improves
a bit.

6 months agoexecute: Get rid of custom logging macros 37040/head
Daan De Meyer [Mon, 7 Apr 2025 19:54:53 +0000 (21:54 +0200)] 
execute: Get rid of custom logging macros

We already have LOG_CONTEXT_PUSH_EXEC() which with two additions
does exactly the same as the custom logging macros, so let's get rid
of the custom logging macros and use LOG_CONTEXT_PUSH_EXEC() instead.

6 months agotimedate: Drop custom logging macros in favor of log context
Daan De Meyer [Mon, 7 Apr 2025 20:06:54 +0000 (22:06 +0200)] 
timedate: Drop custom logging macros in favor of log context

Additionally, using the log context makes sure the extra fields are
applied to all log messages generated while the context is in place,
rather than only log messages logged with log_unit_xxx() in timedated
itself.

It also means the unit name is prefixed to all log messages logged
within that context. While it's not clear whether we always want the
unit name to be attached to library log messages, we also don't want
the unit name to not be attached to any library log messages, so we opt
to add more rather than less information by adding the unit name everywhere
for now.

In the future we can look into some log.h helpers to enable/disable
adding the prefix to the following log messages or not.

6 months agounit: Make sure individual unit maximum log level always takes priority
Daan De Meyer [Mon, 7 Apr 2025 18:06:54 +0000 (20:06 +0200)] 
unit: Make sure individual unit maximum log level always takes priority

Currently LogLevelMax= can only be used to decrease the maximum log level
for a unit but not to increase it. Let's make sure the latter works as
well, so LogLevelMax=debug can be used to enable debug logging for specific
units without enabling debug logging globally.

6 months agolog: Make sure LOG_CONTEXT_SET_LOG_LEVEL() can be nested
Daan De Meyer [Mon, 7 Apr 2025 18:06:34 +0000 (20:06 +0200)] 
log: Make sure LOG_CONTEXT_SET_LOG_LEVEL() can be nested

6 months agohomectl: Use 'user_subvol_rm_allowed' for btrfs by default.
cvlc12 [Tue, 22 Apr 2025 20:36:12 +0000 (22:36 +0200)] 
homectl: Use 'user_subvol_rm_allowed' for btrfs by default.

6 months agoVarious fixes to streamline running code analysis tools such as clang-tidy (#37224)
Daan De Meyer [Wed, 23 Apr 2025 12:34:52 +0000 (14:34 +0200)] 
Various fixes to streamline running code analysis tools such as clang-tidy (#37224)

6 months agocore: Merge forward declaration and definition of DynamicUser 37224/head
Daan De Meyer [Wed, 23 Apr 2025 10:06:16 +0000 (12:06 +0200)] 
core: Merge forward declaration and definition of DynamicUser

6 months agocore: Drop unused forward declaration
Daan De Meyer [Wed, 23 Apr 2025 10:05:54 +0000 (12:05 +0200)] 
core: Drop unused forward declaration

We already include unit.h.

6 months agobasic: Move various macros from assert-util.h to assert-fundamental.h
Daan De Meyer [Sun, 20 Apr 2025 19:20:42 +0000 (21:20 +0200)] 
basic: Move various macros from assert-util.h to assert-fundamental.h

ASSERT_PTR() and friends in assert-fundamental.h make use of assert()
and assert_se() which when not building for sd-boot are defined in
assert-util.h. Because assert() from glibc is only overridden in
assert-util.h, the macros in assert-fundamental.h still end up using
the glibc assert.

Let's fix this by moving the required macros and related logic to
assert-fundamental.h.

6 months agotree-wide: Use assert_se() instead of assert() in various places
Daan De Meyer [Wed, 23 Apr 2025 09:45:59 +0000 (11:45 +0200)] 
tree-wide: Use assert_se() instead of assert() in various places

assert() is compiled away if NDEBUG is set which causes an unused
variable warning in various places when the next commit is applied
so let's use assert_se() to avoid these warnings.

6 months agojournal: Always compile journal authentication related files
Daan De Meyer [Sun, 20 Apr 2025 10:26:53 +0000 (12:26 +0200)] 
journal: Always compile journal authentication related files

Tooling such as clang-tidy is bad at dealing with condition
compilation on the build system level instead of at the source file
level. What happens? It still tries to analyze the file and fails
horribly if the required headers aren't available. Let's work around
the issue and make things more consistent at the same time by doing
the necessary HAVE_GCRYPT checks inside of the source files instead
of doing them at the build system level.

We also add some typedefs to allow getting rid of various HAVE_GCRYPT
checks.

6 months agolibsystemd: Skip _sd-common.h include check when __clang_analyzer__ is defined
Daan De Meyer [Sun, 20 Apr 2025 10:25:42 +0000 (12:25 +0200)] 
libsystemd: Skip _sd-common.h include check when __clang_analyzer__ is defined

This check doesn't work properly when tools such as clang-tidy are
analyzing headers. Since we don't care about the check in that case,
skip it if __clang_analyzer__ is defined similar to how we skip it as
well if __COVERITY__ is defined.

6 months agoboot: Make free() a non inline function
Daan De Meyer [Sun, 20 Apr 2025 10:24:09 +0000 (12:24 +0200)] 
boot: Make free() a non inline function

The static inline declaration in iovec-fundamental.h causes static
analyze tooling warnings (clang-tidy). Let's get around it by making
free() non-inline. LTO will make sure it's still inlined properly.

6 months agoRemove more circular header dependencies (#37185)
Daan De Meyer [Wed, 23 Apr 2025 09:24:02 +0000 (11:24 +0200)] 
Remove more circular header dependencies (#37185)

Continuation of https://github.com/systemd/systemd/pull/37112

6 months agotree-wide: Make sure all headers are standalone 37185/head
Daan De Meyer [Sat, 19 Apr 2025 21:21:55 +0000 (23:21 +0200)] 
tree-wide: Make sure all headers are standalone

Let's make sure all of our headers include everything they require.

6 months agobasic: Use _Static_assert() in missing_audit.h instead of assert_cc()
Daan De Meyer [Wed, 23 Apr 2025 08:19:59 +0000 (10:19 +0200)] 
basic: Use _Static_assert() in missing_audit.h instead of assert_cc()

We want to make the header standalone so it includes all the stuff it
needs. However, including macro.h for assert_cc() doesn't work because
of generate-audit_type-list.sh which would have to become more complex
to handle the extra include directories.

Instead, let's just use _Static_assert() directly which is a builtin and
doesn't need any extra includes.

6 months agotimesync: Remove circular header dependencies
Daan De Meyer [Sat, 19 Apr 2025 21:18:44 +0000 (23:18 +0200)] 
timesync: Remove circular header dependencies

6 months agosysupdate: Remove circular header includes
Daan De Meyer [Sat, 19 Apr 2025 21:12:18 +0000 (23:12 +0200)] 
sysupdate: Remove circular header includes

6 months agoresolved: Remove circular header dependencies
Daan De Meyer [Sat, 19 Apr 2025 20:41:49 +0000 (22:41 +0200)] 
resolved: Remove circular header dependencies

6 months agoresolve: Move implementations of some functions to resolved-dns-packet.c
Daan De Meyer [Sat, 19 Apr 2025 12:07:09 +0000 (14:07 +0200)] 
resolve: Move implementations of some functions to resolved-dns-packet.c

These depend on a full definition of DnsResourceRecord which we want
to forward declare in the next commit, so let's move the implementation
of these functions to the implementation file and make them lowercase.

6 months agoresolve: Move two functions from resolved-conf.h to resolved-dns-server.h
Daan De Meyer [Sat, 19 Apr 2025 11:12:00 +0000 (13:12 +0200)] 
resolve: Move two functions from resolved-conf.h to resolved-dns-server.h

Preparation for getting rid of circular header dependencies.

6 months agoportable: Remove circular header dependencies
Daan De Meyer [Sat, 19 Apr 2025 10:36:37 +0000 (12:36 +0200)] 
portable: Remove circular header dependencies

6 months agonetwork: Remove circular header dependencies in network/netdev
Daan De Meyer [Sat, 19 Apr 2025 10:24:47 +0000 (12:24 +0200)] 
network: Remove circular header dependencies in network/netdev

6 months agonetwork: Remove circular header dependencies in network/tc
Daan De Meyer [Sat, 19 Apr 2025 10:12:20 +0000 (12:12 +0200)] 
network: Remove circular header dependencies in network/tc

Include the headers in the implementation file (and the gperf file)
instead of in the qdisc.h header. I opted to keep them separate from
the other headers since they're slightly different than regular headers.

6 months agonetwork: Move networkd-manager.h include to implementation file
Daan De Meyer [Sat, 19 Apr 2025 10:11:50 +0000 (12:11 +0200)] 
network: Move networkd-manager.h include to implementation file

6 months agomachine: Remove circular header dependencies
Daan De Meyer [Fri, 18 Apr 2025 22:13:45 +0000 (00:13 +0200)] 
machine: Remove circular header dependencies

6 months agologin: Remove circular header dependencies
Daan De Meyer [Fri, 18 Apr 2025 21:53:19 +0000 (23:53 +0200)] 
login: Remove circular header dependencies

6 months agojournal: Remove circular header dependencies
Daan De Meyer [Fri, 18 Apr 2025 20:08:04 +0000 (22:08 +0200)] 
journal: Remove circular header dependencies

6 months agoimport: Remove circular header dependencies
Daan De Meyer [Fri, 18 Apr 2025 19:48:08 +0000 (21:48 +0200)] 
import: Remove circular header dependencies