]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
7 months agoupdate TODO 36688/head
Lennart Poettering [Mon, 10 Mar 2025 13:39:53 +0000 (14:39 +0100)] 
update TODO

7 months agotest: add test for nsresourced
Lennart Poettering [Tue, 11 Mar 2025 05:06:40 +0000 (06:06 +0100)] 
test: add test for nsresourced

7 months agonsresource: turn feature absence error into EOPNOTSUPP
Lennart Poettering [Wed, 12 Mar 2025 17:00:57 +0000 (18:00 +0100)] 
nsresource: turn feature absence error into EOPNOTSUPP

Let's make it easy for local clients to treat feature absence as a
simple EOPNOTSUPP check.

7 months agovarlink: add full introspection comments for io.systemd.NamespaceResource
Lennart Poettering [Tue, 11 Mar 2025 09:40:04 +0000 (10:40 +0100)] 
varlink: add full introspection comments for io.systemd.NamespaceResource

7 months agonsresourced: check polkit before executing our operations
Lennart Poettering [Mon, 10 Mar 2025 12:39:53 +0000 (13:39 +0100)] 
nsresourced: check polkit before executing our operations

Let's tighten rules on namespace operations: let's always ask PK for
permission before doing anything.

Note that if polkit is absent we'll still allow things, and the default
PK policy will also still allow things, but there's now a clear way how
people can not allow things if they want, by modifying the PK policy.

7 months agonsresourced: put a limit on delegated network interfaces too
Lennart Poettering [Mon, 10 Mar 2025 11:57:29 +0000 (12:57 +0100)] 
nsresourced: put a limit on delegated network interfaces too

7 months agonsresourced: explicitly remove network interfaces when their userns goes away
Lennart Poettering [Mon, 10 Mar 2025 11:39:35 +0000 (12:39 +0100)] 
nsresourced: explicitly remove network interfaces when their userns goes away

Let's tighten the screws a bit on the network interfaces we delegate,
and explicitly destroy them, just like we destroy delegated cgroups.

Ideally, this should happen automatically because the userns goes away
that pins the veth, or because the client holding an fd for a tap device
goes away as the userns goes away. But you never know who keeps a
reference, hence let's explicitly destroy this too.

7 months agovmspawn: support unpriv tap networking
Lennart Poettering [Mon, 10 Mar 2025 10:36:39 +0000 (11:36 +0100)] 
vmspawn: support unpriv tap networking

7 months agonsresource: add client-side wrapper for creating tap links
Lennart Poettering [Mon, 10 Mar 2025 10:36:05 +0000 (11:36 +0100)] 
nsresource: add client-side wrapper for creating tap links

7 months agonetwork: also manage namespace tap links
Lennart Poettering [Mon, 10 Mar 2025 10:20:29 +0000 (11:20 +0100)] 
network: also manage namespace tap links

7 months agonsresourced: add ability to delegate tap device
Lennart Poettering [Sun, 9 Mar 2025 07:14:09 +0000 (08:14 +0100)] 
nsresourced: add ability to delegate tap device

7 months agonsresourced: permit differing uid/gid
Lennart Poettering [Sun, 9 Mar 2025 07:13:07 +0000 (08:13 +0100)] 
nsresourced: permit differing uid/gid

7 months agonamespace: simplify apply_one_mount() a bit
Lennart Poettering [Mon, 10 Mar 2025 10:33:50 +0000 (11:33 +0100)] 
namespace: simplify apply_one_mount() a bit

Drop a bunch of unnecessary casts, format strings, and {} blocks.

7 months agonamespace-util: introduce userns_acquire_self_root()
Lennart Poettering [Mon, 10 Mar 2025 10:30:11 +0000 (11:30 +0100)] 
namespace-util: introduce userns_acquire_self_root()

This is a simple helper for creating a userns that just maps the
callers user to UID 0 in the namespace. This can be acquired unpriv,
which makes it useful for various purposes, for example for the logic in
is_idmapping_supported(), hence port it over.

(is_idmapping_supported() used a different mapping before, with the
nobody users, but there's no real reason for that, and we'll use
userns_acquire_self_root() elsewhere soon, where the root mapping is
important).

7 months agonamespace-util: make "setgroups" users property writable via userns_acquire()
Lennart Poettering [Mon, 10 Mar 2025 10:24:59 +0000 (11:24 +0100)] 
namespace-util: make "setgroups" users property writable via userns_acquire()

Unprivileged namespaces are only allowed if the "setgroups" file is set
to "deny" for processes. And we need to write it before writing the
gidmap. Hence add a parameter for that.

Then, also patch all current users to actually enable this. The usecase
generally don't need it (because they don't care about unprivileged
userns), but it doesn't hurt to enable the concept anyway in all current
users (none of them actually runs complex userspace in them, but they
mostly use userns_acquire() for idmapped mounts and similar).

Let's anyway make this option explicit in the function call, to indicate
that the concept exists and is applied.

7 months agobetter support for $COLORTERM (#36770)
Lennart Poettering [Mon, 17 Mar 2025 12:17:06 +0000 (13:17 +0100)] 
better support for $COLORTERM (#36770)

I recently noticed that our serial/VM terminals did not get fedora's
color shell prompt, nor got color support in "ls".

I spend a bit of time investigating and it's all a bit of a mess. If we
don't have any idea what kind of terminal we are talking to via serial
or hypervisor console then we so far just set TERM=vt220 as a reasonable
fallback: vt220 is quite universally defined in terminfo/termcap, and it
supports pageup/pagedown (unlike vt100).

However, real vt220 DEC terminals did not support color, and hence
termcap/terminfo says "no color, sorry". Which sucks, but actually
neither coreutils' "ls" (via `dircolors`) nor fedora's color shell
prompt actually care for termcap/terminfo. So why don't we get color?

In the coreutils case: it has it's own mini-database of terminals. A
very skewed one, where TERM=vt100 enables colors (and DEC vt100
definitely never ever had color support!), but vt220 does not. However,
what it actually does is check $COLORTERM. If that's set then it would
enable color.

In the fedora color prmpt case: it tries to derive color support by
looking for the word "color" in $TERM. Horrible hack if you ask me...

In order to make things better I did a bunch of things:

1. I think the idea of actually having a fully correct and up-to-date
termcap/terminfo database is kinda illusionary these days. But
apparently regarding color support $COLORTERM kinda took it place.
coreutils cares, and systemd itself cares too. To some point at least:
we consume it to determine color support, but we never propagate it in
nspawn, run0 and so on. So this PR fixes that.

2. Also, we are kinda stuck with vt220 I guess as default fallback for
serial terminals. But let's tweak it, and set $COLORTERM=truecolor as
default too. this means we default to a vt220 terminal, but with color.
Which is an ahistorical thing to do, but I think it's the best way out.

3. I also filed a bug against util-linux asking them to treat $COLORTERM
like $TERM, and let it propagate from getty into login shell:
https://github.com/util-linux/util-linux/issues/3463 – With that we
should get color support in ls by default now.

4. I also asked coreutils to treat vt220 the same as they already treat
vt100 and simply do color, even if though that's ahistorical:
https://github.com/coreutils/coreutils/issues/96

5. I then asked the fedora color prompt package to check $COLORTERM:
https://bugzilla.redhat.com/show_bug.cgi?id=2352650

6. I also asked the fedora ssh package to propagate $COLORTERM to remote
hosts by default, like they already cover $TERM. terminal emulators set
both these days generally, hence this would make sense.
https://bugzilla.redhat.com/show_bug.cgi?id=2352653

7. while at it, I figured it makes sense to not only propagate/consume
$COLORTERM at the same time as $TERM, but also consider $NO_COLOR. In
contrast to $COLORTERM for which no spec seems to exist, that one
actually does have a spec: https://no-color.org/

It might make sense for those interested in other distros than Fedora to
maybe ask for similar changes for their ssh and color shell prompt
packages (if they have something coresponding).

7 months agobuild: add C23 support (#35085)
Luca Boccassi [Mon, 17 Mar 2025 11:29:33 +0000 (11:29 +0000)] 
build: add C23 support (#35085)

To support C23, this introduces UTF8() macro to define UTF-8 literals,
as C23 changed char8_t from char to unsigned char.
This also makes pointer signedness warning critical, and updates C
standards table for tests.

7 months agoudev: several follow-ups and cleanups for builtin commands (#36768)
Lennart Poettering [Mon, 17 Mar 2025 09:42:55 +0000 (10:42 +0100)] 
udev: several follow-ups and cleanups for builtin commands (#36768)

7 months agocopy: Fix error handling in fd_copy_directory()
Daan De Meyer [Wed, 12 Mar 2025 16:06:43 +0000 (17:06 +0100)] 
copy: Fix error handling in fd_copy_directory()

7 months agonspawn,run,machinectl,socket-activate: propagate $COLORTERM + $NO_COLOR 36770/head
Lennart Poettering [Mon, 17 Mar 2025 08:52:52 +0000 (09:52 +0100)] 
nspawn,run,machinectl,socket-activate: propagate $COLORTERM + $NO_COLOR

When we pass information about our calling terminal on to some service
or command we invoke, propagate $COLORTERM + $NO_COLOR in addition to
$TERM, in order to always consider the triplet of the three env vars the
real deal.

7 months agomain: explicitly pick up $COLORTERM + $NO_COLOR from kernel cmdline where we pick...
Lennart Poettering [Mon, 17 Mar 2025 08:45:16 +0000 (09:45 +0100)] 
main: explicitly pick up $COLORTERM + $NO_COLOR from kernel cmdline where we pick up $TERM

I think we should work towards always picking up the triplet of $TERM +
$COLORTERM + $NO_COLOR where we so far picked up $TERM only. I think
it's safe to say that at this time, $TERM is not enough anymore to
clearly communicate terminal feature support. Hence, teach PID 1 to pick
$COLORTERM + $NO_COLOR wherever we pick up $TERM.

7 months agoexec: when we have no $TERM configuration, and we default to vt220, also set $COLORTERM
Lennart Poettering [Mon, 17 Mar 2025 08:34:49 +0000 (09:34 +0100)] 
exec: when we have no $TERM configuration, and we default to vt220, also set $COLORTERM

When we configure a serial or VM terminal and have no $TERM
configuration, then we default to vt220 as a fallback. This is a pretty
safe bet, since the termcap/terminfo definitions for vt220 are
relatively widely available (much like vt100), and (in contrast to
vt100) it supports pageup/pagedown keys. vt220 is a terminal without
color support however, but we do want color support, because in 2025
there's really no terminal emulator without color in this world.

The $COLORTERM env var is used my many emulators and tools to
communicate that ANSI color support is available, despite what $TERM
says. Hence, let's tweak systemd's logic to also set $COLORTERM in case
we set the vt220 $TERM fallback.

This means we define an ahistoric frankenterminal: a vt220 (that
historically definitely didn't have color) that is explicitly configured
to have color.

One effect of this is that coreutils' dircolors command will start to
output color sequences in systemd's serial or VM terminals. (Since it
actually honours $COLORTERM).

Also note that systemd itself checks $COLORTERM since a long time, hence
it makes sense for us to also set it.

Note that this unfortunately doesn't have the desired effect of
propagating $COLORTERM into any getty shell sessions yet. That's because
util-linux' login package currently fiters $COLORTERM (but lets $TERM
though). I filed a bug about that here:

https://github.com/util-linux/util-linux/issues/3463

7 months agoTEST-17-UDEV: add more test cases for udev builtins 36768/head
Yu Watanabe [Mon, 17 Mar 2025 03:04:52 +0000 (12:04 +0900)] 
TEST-17-UDEV: add more test cases for udev builtins

7 months agoshell-completion: add factory_reset udev builtin command
Yu Watanabe [Mon, 17 Mar 2025 02:24:14 +0000 (11:24 +0900)] 
shell-completion: add factory_reset udev builtin command

7 months agoudev-builtin-btrfs: refuse to call for irrelevant device node
Yu Watanabe [Mon, 17 Mar 2025 03:18:41 +0000 (12:18 +0900)] 
udev-builtin-btrfs: refuse to call for irrelevant device node

If btrfs builtin command is called, then check if the specified device
node is owned by the device.
This also allows the command is called specifying any device node.

7 months agoudev-builtin: make btrfs builtin command only check arguments when run in test mode
Yu Watanabe [Mon, 17 Mar 2025 03:04:24 +0000 (12:04 +0900)] 
udev-builtin: make btrfs builtin command only check arguments when run in test mode

7 months agoudev-builtin: add missing UDEV_RELOAD_BUILTIN_FACTORY_RESET
Yu Watanabe [Mon, 17 Mar 2025 03:03:12 +0000 (12:03 +0900)] 
udev-builtin: add missing UDEV_RELOAD_BUILTIN_FACTORY_RESET

7 months agoudev-builtin: align builtins table
Yu Watanabe [Mon, 17 Mar 2025 02:19:05 +0000 (11:19 +0900)] 
udev-builtin: align builtins table

7 months agopo: Translated using Weblate (Japanese)
Y T [Mon, 17 Mar 2025 03:11:07 +0000 (03:11 +0000)] 
po: Translated using Weblate (Japanese)

Currently translated at 100.0% (261 of 261 strings)

Co-authored-by: Y T <yi818670@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ja/
Translation: systemd/main

7 months agorun: trivial followups (#36765)
Yu Watanabe [Mon, 17 Mar 2025 03:27:49 +0000 (12:27 +0900)] 
run: trivial followups (#36765)

7 months agorun: refuse --pty-late for Type=oneshot services 36765/head
Mike Yuan [Sun, 16 Mar 2025 23:21:46 +0000 (00:21 +0100)] 
run: refuse --pty-late for Type=oneshot services

Such combination makes no sense, as by the time the start job
of the oneshot service finishes the main process has already
exited.

Addresses https://github.com/systemd/systemd/pull/36691#discussion_r1988116881

7 months agorun: void'ify sd_event_exit() call
Mike Yuan [Sun, 16 Mar 2025 23:11:12 +0000 (00:11 +0100)] 
run: void'ify sd_event_exit() call

7 months agorun: "trigger" consists of more than timer units
Mike Yuan [Sun, 16 Mar 2025 23:26:45 +0000 (00:26 +0100)] 
run: "trigger" consists of more than timer units

7 months agonspawn: introduce --cleanup option (#34776)
Yu Watanabe [Sun, 16 Mar 2025 21:53:46 +0000 (06:53 +0900)] 
nspawn: introduce --cleanup option (#34776)

This is useful when the previous invocation is unexpectedly killed.

Otherwise, if systemd-nspawn is killed forcibly, then unix-export
directory is not cleared and unmounted, and the subsequent invocation
will fail. E.g.
```
[   18.895515] TEST-13-NSPAWN.sh[645]: + machinectl start long-running
[   18.945703] systemd-nspawn[1387]: Mount point '/run/systemd/nspawn/unix-export/long-running' exists already, refusing.
[   18.949236] systemd[1]: systemd-nspawn@long-running.service: Failed with result 'exit-code'.
[   18.949743] systemd[1]: Failed to start systemd-nspawn@long-running.service.
```

7 months agomeson: Check for lxml before generating indicies
Jordan Petridis [Thu, 13 Mar 2025 14:17:45 +0000 (16:17 +0200)] 
meson: Check for lxml before generating indicies

Followup to c0cc01de8a0249fb80684c861e50c939aa67d91e

The targets that create indicies have
`install : want_html and have_lxml` but some other
code like the `install_symlink` was not gated by
accident.

We ican put the whole loop behind have_lxml as its
required for all the indicies.

7 months agocgroup v1 preliminaries (#36622)
Mike Yuan [Sun, 16 Mar 2025 19:27:48 +0000 (20:27 +0100)] 
cgroup v1 preliminaries (#36622)

7 months agoman: remove libsystemd reference to legacy hierarchy 36622/head
Mike Yuan [Wed, 5 Mar 2025 18:10:02 +0000 (19:10 +0100)] 
man: remove libsystemd reference to legacy hierarchy

7 months agocgroup-util: drop is_cgroup_fs()
Mike Yuan [Wed, 5 Mar 2025 17:59:09 +0000 (18:59 +0100)] 
cgroup-util: drop is_cgroup_fs()

No need to bother with any cgroup v1 stuff anymore.

7 months agocore/taint: we know we're always running on cgv2 now
Mike Yuan [Sun, 16 Mar 2025 14:24:18 +0000 (15:24 +0100)] 
core/taint: we know we're always running on cgv2 now

7 months agocore/main: refuse bootup with legacy cgroup hierarchy
Mike Yuan [Wed, 5 Mar 2025 17:55:41 +0000 (18:55 +0100)] 
core/main: refuse bootup with legacy cgroup hierarchy

First step towards a unified-only future (rework of internals
coming soon (TM))

7 months agocgroup-setup: drop hierarchy detection, always use v2
Mike Yuan [Wed, 5 Mar 2025 16:57:27 +0000 (17:57 +0100)] 
cgroup-setup: drop hierarchy detection, always use v2

7 months agomount-setup: remove cgroup v1 hierarchy mounting
Mike Yuan [Wed, 5 Mar 2025 16:53:44 +0000 (17:53 +0100)] 
mount-setup: remove cgroup v1 hierarchy mounting

7 months agosemaphore-runner: disable cgroup setup in lxc
Mike Yuan [Mon, 10 Mar 2025 18:42:05 +0000 (19:42 +0100)] 
semaphore-runner: disable cgroup setup in lxc

lxc tries to mount /sys/fs/cgroup/ following host hierarchy by default,
which is problematic for us since we want to unconditionally use
cgroup v2 in cgns. Disable it hence and let pid1 figure it out.

7 months agosemaphore-runner: drop outdated comment
Mike Yuan [Mon, 10 Mar 2025 18:18:47 +0000 (19:18 +0100)] 
semaphore-runner: drop outdated comment

7 months agomount-setup: generalize cgroupfs_recursiveprot_supported()
Mike Yuan [Thu, 6 Mar 2025 11:56:29 +0000 (12:56 +0100)] 
mount-setup: generalize cgroupfs_recursiveprot_supported()

7 months agotest-execute: use time event source rather than custom timeout check
Yu Watanabe [Sun, 16 Mar 2025 03:00:14 +0000 (12:00 +0900)] 
test-execute: use time event source rather than custom timeout check

Fixes CID#1593786.

7 months agoTEST-13-NSPAWN: re-enable KILL test 34776/head
Yu Watanabe [Tue, 15 Oct 2024 08:28:17 +0000 (17:28 +0900)] 
TEST-13-NSPAWN: re-enable KILL test

7 months agonspawn: introduce --cleanup option to clear propagation and unix-export directories
Yu Watanabe [Tue, 15 Oct 2024 08:25:09 +0000 (17:25 +0900)] 
nspawn: introduce --cleanup option to clear propagation and unix-export directories

This is useful when the previous invocation is unexpectedly killed.

Otherwise, if systemd-nspawn is killed forcibly, then unix-export
directory is not cleared and unmounted, and the subsequent invocation
will fail. E.g.
===
[   18.895515] TEST-13-NSPAWN.sh[645]: + machinectl start long-running
[   18.945703] systemd-nspawn[1387]: Mount point '/run/systemd/nspawn/unix-export/long-running' exists already, refusing.
[   18.949236] systemd[1]: systemd-nspawn@long-running.service: Failed with result 'exit-code'.
[   18.949743] systemd[1]: Failed to start systemd-nspawn@long-running.service.
===

7 months agomeson: update C standards table for building header tests 35085/head
Yu Watanabe [Sun, 16 Mar 2025 01:05:17 +0000 (10:05 +0900)] 
meson: update C standards table for building header tests

7 months agomeson: make pointer-sign warning critical
Yu Watanabe [Sun, 16 Mar 2025 01:10:28 +0000 (10:10 +0900)] 
meson: make pointer-sign warning critical

With the previous commit, no pointer signedness warning should be
triggered even built with C23. Let's make the warning critical.

7 months agomacro: Introduce UTF8() macro to define UTF-8 string literal
Yu Watanabe [Sun, 16 Mar 2025 00:31:43 +0000 (09:31 +0900)] 
macro: Introduce UTF8() macro to define UTF-8 string literal

C23 changed char8_t from char to unsigned char, hence assigning a u8 literal
to const char* emits pointer sign warning, e.g.
========
../src/shared/qrcode-util.c: In function ‘print_border’:
../src/shared/qrcode-util.c:16:34: warning: pointer targets in passing argument 1 of ‘fputs’ differ in signedness [-Wpointer-sign]
   16 | #define UNICODE_FULL_BLOCK       u8"█"
      |                                  ^~~~~
      |                                  |
      |                                  const unsigned char *
../src/shared/qrcode-util.c:65:39: note: in expansion of macro ‘UNICODE_FULL_BLOCK’
   65 |                                 fputs(UNICODE_FULL_BLOCK, output);
      |                                       ^~~~~~~~~~~~~~~~~~
========

This introduces UTF8() macro, which define u8 literal and casts to consth char*,
then rewrites all u8 literal definitions with the macro.
With this change, we can build systemd with C23.

7 months agoFix bootctl status to not print strange glyphs in logs (#36745)
Yu Watanabe [Sat, 15 Mar 2025 20:56:55 +0000 (05:56 +0900)] 
Fix bootctl status to not print strange glyphs in logs (#36745)

7 months agonetwork: fix unexpected removal of routes on restart even when KeepConfiguration...
Yu Watanabe [Sat, 15 Mar 2025 14:19:49 +0000 (23:19 +0900)] 
network: fix unexpected removal of routes on restart even when KeepConfiguration=yes (#36756)

7 months agobootctl: do not print special glyphs to the log 36745/head
Zbigniew Jędrzejewski-Szmek [Sun, 9 Mar 2025 09:50:04 +0000 (10:50 +0100)] 
bootctl: do not print special glyphs to the log

The log line looked like this:
  bootctl[1457]: ! Mount point '/efi' which backs the random seed file is world accessible, which is a security hole! !
which doesn't look nice.

Also upgrade the message to error. This is something to fix.

7 months agobasic/glyph-util: introduce optional_glyph() to wrap emoji_enabled()
Zbigniew Jędrzejewski-Szmek [Sun, 9 Mar 2025 09:43:25 +0000 (10:43 +0100)] 
basic/glyph-util: introduce optional_glyph() to wrap emoji_enabled()

7 months agobasic/glyph-util: rename "special glyph" to just "glyph"
Zbigniew Jędrzejewski-Szmek [Fri, 14 Mar 2025 09:42:04 +0000 (10:42 +0100)] 
basic/glyph-util: rename "special glyph" to just "glyph"

Admittedly, some of our glyphs _are_ special, e.g. "O=" for SPECIAL_GLYPH_TOUCH ;)
But we don't need this in the name. The very long names make some invocations
very wordy, e.g. special_glyph(SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY).
Also, I want to add GLYPH_SPACE, which is not special at all.

7 months agoseveral fixes for Coverity (#36753)
Luca Boccassi [Sat, 15 Mar 2025 11:46:14 +0000 (11:46 +0000)] 
several fixes for Coverity (#36753)

7 months agotest-cgroup-util: allow ESRCH in cg_pidref_get_path() and friends 36753/head
Yu Watanabe [Sat, 15 Mar 2025 01:46:36 +0000 (10:46 +0900)] 
test-cgroup-util: allow ESRCH in cg_pidref_get_path() and friends

As the process may be already dead.

Follow-ups for ca82f0cbe2db096bc7ff81280b5683ea1beae534.

7 months agotest-network: check that network configuration is stable with KeepConfiguration=yes 36756/head
Matteo Croce [Wed, 12 Mar 2025 13:36:14 +0000 (14:36 +0100)] 
test-network: check that network configuration is stable with KeepConfiguration=yes

Check that when networkd restarts, and the network configures
KeepConfiguration=yes, the network configuration is never changed.

Ensure this by dumping the `ip monitor` output when networkd is restarting.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
7 months agonetwork: do not remove static routes on other interfaces that are currently in the...
Yu Watanabe [Sat, 15 Mar 2025 00:38:09 +0000 (09:38 +0900)] 
network: do not remove static routes on other interfaces that are currently in the pending state

Otherwise, even if .network file has KeepConfiguration=yes, routes on
an interfaces may be removed on restart.

Fixes a bug introduced by 8d01e44c1f0e00b414d36bd1b46ecff548242208.

7 months agotest: drop redundant parentheses in ASSERT_OK() and friends
Yu Watanabe [Sat, 15 Mar 2025 00:04:25 +0000 (09:04 +0900)] 
test: drop redundant parentheses in ASSERT_OK() and friends

This reverts 278e3adf50e36518c5a5dd798ca998e7eac5436e, and drop more
redundant parentheses, as they unfortunately does not suppress the
false-positive warnings by coverity.

7 months agomeson: handle bool-compare warning as error
Yu Watanabe [Fri, 14 Mar 2025 22:21:33 +0000 (07:21 +0900)] 
meson: handle bool-compare warning as error

Then we can detect the error fixed by the previous commit like the following:

../src/libsystemd/sd-device/test-sd-device.c: In function ‘test_sd_device_enumerator_add_all_parents’:
../src/shared/tests.h:225:51: error: comparison of constant ‘0’ with boolean expression is always true [-Werror=bool-compare]
  225 | #define ASSERT_OK(expr) __coverity_check__((expr) >= 0)
      |                                                   ^~
../src/libsystemd/sd-device/test-sd-device.c:547:9: note: in expansion of macro ‘ASSERT_OK’
  547 |         ASSERT_OK(sd_device_enumerator_add_all_parents(e) >= 0);
      |         ^~~~~~~~~

7 months agotest: fix wrong use of ASSERT_OK() and friends
Yu Watanabe [Fri, 14 Mar 2025 22:20:45 +0000 (07:20 +0900)] 
test: fix wrong use of ASSERT_OK() and friends

7 months agotests: replace ASSERT_OK() and friends with coverity firendy function
Yu Watanabe [Fri, 14 Mar 2025 21:51:18 +0000 (06:51 +0900)] 
tests: replace ASSERT_OK() and friends with coverity firendy function

We already have done the same for assert_se() since
d9fb7afb4890a93db478616e7bfc639b2129b466.

Hopefully this makes coverity silent about the false-positive side-effect
warnings.

7 months agotest-macro: CONST_MAX() and friends may return (void*)0 when built under coverity
Yu Watanabe [Fri, 14 Mar 2025 21:48:37 +0000 (06:48 +0900)] 
test-macro: CONST_MAX() and friends may return (void*)0 when built under coverity

See 963c6c90af87fdf8b7dcb942991fb018b87fea07.

7 months agojournal-remote: added custom headers support
Andrii Chubatiuk [Wed, 16 Oct 2024 12:06:19 +0000 (15:06 +0300)] 
journal-remote: added custom headers support

7 months agoudevadm: check number of passed arguments
Lennart Poettering [Fri, 14 Mar 2025 10:43:07 +0000 (11:43 +0100)] 
udevadm: check number of passed arguments

We didn't check the number of arguments first, hence ended up outputting
some ugly complaints with `(null)` in a format string. And what's worse
accepted any number of arguments, where we'd ignore all but the first
two though.

7 months agofirstboot: welcome user with emoji in firstboot wizard 🧙
Lennart Poettering [Fri, 14 Mar 2025 14:44:31 +0000 (15:44 +0100)] 
firstboot: welcome user with emoji in firstboot wizard 🧙

7 months agoRestore docs/PAX_CONTROL_GROUPS
Zbigniew Jędrzejewski-Szmek [Fri, 14 Mar 2025 10:33:55 +0000 (11:33 +0100)] 
Restore docs/PAX_CONTROL_GROUPS

This partially reverts 8d04b8198d4c0cca0118f731369ad7156f0726b6.
If we completely drop the file, users will get a 404. But this document
has been in place for a long time and is referred to in many other places,
incl. our old wiki at https://www.freedesktop.org/wiki/Software/.
The page already says that it's been replaced
("… Please consult this document only as a historical reference. …").
We should only remove it from the index (which
8d04b8198d4c0cca0118f731369ad7156f0726b6 did).

In general, let's be more careful about preserving link stability.
When we change something in a way that breaks URLs, we're creating
pain for users.

7 months agodocs/ROOTFS_DISCOVERY: removed doubled dot
Zbigniew Jędrzejewski-Szmek [Fri, 14 Mar 2025 10:06:37 +0000 (11:06 +0100)] 
docs/ROOTFS_DISCOVERY: removed doubled dot

Inadvertent change in 487b95d9b6eb42c5213f413308b915e8be17d509.

7 months agomkosi: update debian commit reference
Luca Boccassi [Thu, 13 Mar 2025 13:12:42 +0000 (13:12 +0000)] 
mkosi: update debian commit reference

d8c7f8f7f4 Update changelog for 257.4-2 release
f74cf88300 Split bootctl to new systemd-boot-tools package
10a8764966 Update changelog for 257.4-1 release

7 months agoanalyze: don't connect to bus from analyze test run (#36719)
Lennart Poettering [Thu, 13 Mar 2025 16:51:45 +0000 (17:51 +0100)] 
analyze: don't connect to bus from analyze test run (#36719)

This thing should not be "live", hence don't try to connect to the bus,
or bind the private bus socket.

Fixes: #36540
7 months agoemergency-action: sleep 5s before rebooting in various cases
Lennart Poettering [Wed, 12 Mar 2025 10:17:29 +0000 (11:17 +0100)] 
emergency-action: sleep 5s before rebooting in various cases

This adds a new EMERGENCY_ACTION_SLEEP_5S flag, which when set will
delay the emergency action for 5s. This is supposed to be used together
with EMERGENCY_ACTION_WARN so that users can actually read the message
we output.

We enable this with all emergency action requests that already set
EMERGENCY_ACTION_WARN, except for the 7x ctrl-alt-del burst reboot,
where the user knows what they do and there's no real reason to wait,
they don't need to be informed.

This also enables both EMERGENCY_ACTION_WARN + EMERGENCY_ACTION_SLEEP_5S
for FailureAction= processing of regular units, where these were so far
off. (it leaves this off for SuccessAction= however!). This is a good
thing to make things more debuggable: if something fails and we reboot
this really deserves notification of the user.

(For SuccessAction= this logic does not apply, since the shutdown action
induced here is apparently intended part of the codeflow, for example in
systemd-reboot.service or a similar unit, where the shutdown is goal and
not exception and derserves no additional noisy reporting).

Inspired by: https://github.com/systemd/systemd/pull/36705#issuecomment-2717014120

7 months agodocs/ROOTFS_DISCOVERY: minor wording and syntactic improvements
Zbigniew Jędrzejewski-Szmek [Thu, 13 Mar 2025 13:29:17 +0000 (14:29 +0100)] 
docs/ROOTFS_DISCOVERY: minor wording and syntactic improvements

7 months agotest-execute: prominently show which test we are about to enter 36719/head
Lennart Poettering [Thu, 13 Mar 2025 10:49:13 +0000 (11:49 +0100)] 
test-execute: prominently show which test we are about to enter

7 months agoexecute: add some minor debug logging
Lennart Poettering [Thu, 13 Mar 2025 10:43:08 +0000 (11:43 +0100)] 
execute: add some minor debug logging

7 months agopid1: don't connect to oomd in test runs
Lennart Poettering [Thu, 13 Mar 2025 10:13:44 +0000 (11:13 +0100)] 
pid1: don't connect to oomd in test runs

7 months agoanalyze: don't connect to bus from analyze test run
Lennart Poettering [Wed, 12 Mar 2025 17:19:34 +0000 (18:19 +0100)] 
analyze: don't connect to bus from analyze test run

This thing should not be "live", hence don't try to connect to the bus,
or bind the private bus socket.

Fixes: #36540
7 months agomanager: explicitly create our private runtime directory
Lennart Poettering [Thu, 13 Mar 2025 10:43:46 +0000 (11:43 +0100)] 
manager: explicitly create our private runtime directory

So far /run/systemd/ was created as side-effect of initializing the
D-Bus client/server. But in one of the next commits we'll suppress
connecting to D-Bus in test runs, hence let's move the logic our of the
D-Bus code and into manager_startup().

Then, also drop creating it again and again in PID 1 at various places,
and just rely on it to exist.

7 months agocoredump,analyze: use read_full_file() for reading various top-level /proc/ files
Lennart Poettering [Thu, 13 Mar 2025 08:30:23 +0000 (09:30 +0100)] 
coredump,analyze: use read_full_file() for reading various top-level /proc/ files

Kernel API file systems typically use either "raw" or "seq_file" to
implement their various interface files. The former are really simple
(to point I'd call them broken), in that they have no understanding of
file offsets, and return their contents again and again on every read(),
and thus EOF is indicated by a short read, not by a zero read. The
latter otoh works like a typical file: you read until you get a
zero-sized read back.

We have read_virtual_file() to read the "raw" files, and can use regular
read_full_file() to read the "seq_file" ones.

Apparently all files in the top-level /proc/ directory use 'seq_file'.
but we accidentally used read_virtual_file() for them. Fix that.

Also clarify in a comment what the rules are.

Fixes: #36131
7 months agobootctl: make sure bootctl --image= works on image with /usr/ but without / (#36727)
Lennart Poettering [Thu, 13 Mar 2025 13:14:56 +0000 (14:14 +0100)] 
bootctl: make sure bootctl --image= works on image with /usr/ but without / (#36727)

```
Let's make sure we can use the tool on ParticleOS images. They have no
root fs by default (until they are instantiated), but always have /usr/.
Hence add DISSECT_IMAGE_USR_NO_ROOT which has the desired effect.
```

7 months agobootctl: tweak status output when operating on --image= files 36727/head
Lennart Poettering [Wed, 12 Mar 2025 20:59:49 +0000 (21:59 +0100)] 
bootctl: tweak status output when operating on --image= files

Let's not claim the system was not booted with UEFI if we use --image=.
The system wasn't booted at all, after all. Hence supress the whole
section altogether in this case.

7 months agobootctl: make sure bootctl --image= works on image with /usr/ but without /
Lennart Poettering [Wed, 12 Mar 2025 20:56:36 +0000 (21:56 +0100)] 
bootctl: make sure bootctl --image= works on image with /usr/ but without /

Let's make sure we can use the tool on ParticleOS images. They have no
root fs by default (until they are instantiated), but always have /usr/.
Hence add DISSECT_IMAGE_USR_NO_ROOT which has the desired effect.

7 months agoupdate TODO
Lennart Poettering [Thu, 13 Mar 2025 09:35:17 +0000 (10:35 +0100)] 
update TODO

7 months agoupdate TODO
Lennart Poettering [Thu, 13 Mar 2025 08:55:59 +0000 (09:55 +0100)] 
update TODO

7 months agotest-localed-util: use ASSERT_OK() and friends
Yu Watanabe [Thu, 13 Mar 2025 03:49:02 +0000 (12:49 +0900)] 
test-localed-util: use ASSERT_OK() and friends

7 months agoTEST-73-LOCALE: do not unnecessarily restart systemd-localed
Yu Watanabe [Thu, 13 Mar 2025 03:11:40 +0000 (12:11 +0900)] 
TEST-73-LOCALE: do not unnecessarily restart systemd-localed

It is not necessary to clear previous keymap assignment, as
`localectl set-keymap` will anyway overwrite the previous assignment.

This drops the unnecessary restart of systemd-localed in the loop.
The mkosi test image contains about 500~700 keymaps. The test
performance is greatly improved by reducing the number of restarts,
especially when the test is running with sanitizers.

On Fedora 41 with sanitizers,
Before:
1/1 systemd:integration-tests / TEST-73-LOCALE OK             1157.50s
After:
1/1 systemd:integration-tests / TEST-73-LOCALE OK              104.43s

7 months agoFix several issues found by Coverity (#36726)
Yu Watanabe [Wed, 12 Mar 2025 22:54:06 +0000 (07:54 +0900)] 
Fix several issues found by Coverity (#36726)

7 months agocopy: Bubble up ENOSPC immediately in fd_copy_directory()
Daan De Meyer [Wed, 12 Mar 2025 16:07:55 +0000 (17:07 +0100)] 
copy: Bubble up ENOSPC immediately in fd_copy_directory()

It doesn't really make sense to continue once we start getting ENOSPC.

7 months agoman: document how Restart= reacts to oom kill
Lennart Poettering [Wed, 12 Mar 2025 21:08:46 +0000 (22:08 +0100)] 
man: document how Restart= reacts to oom kill

Fixes: #36529
7 months agonsresource: fix GID check in io.systemd.UserDatabase.GetGroupRecord method
Yu Watanabe [Wed, 12 Mar 2025 18:27:31 +0000 (03:27 +0900)] 
nsresource: fix GID check in io.systemd.UserDatabase.GetGroupRecord method

Fixes a bug in 8aee931e7ae1adb01eeac0e1e4c0aef6ed3969ec (v256).

7 months agogetty-generator: don't use "3270!tty1" when instantiating serial-getty@.service on...
Franck Bui [Wed, 12 Mar 2025 16:51:39 +0000 (17:51 +0100)] 
getty-generator: don't use "3270!tty1" when instantiating serial-getty@.service on s390x

Path of the 3270 console in /sys is "/sys/class/tty/3270!tty1" but its device
node is "/dev/3270/tty1".

7 months agonsresource: fix error handling
Yu Watanabe [Wed, 12 Mar 2025 18:21:01 +0000 (03:21 +0900)] 
nsresource: fix error handling

7 months agoboot: several follow-ups for reboot-on-error feature (#36721)
Yu Watanabe [Wed, 12 Mar 2025 20:26:47 +0000 (05:26 +0900)] 
boot: several follow-ups for reboot-on-error feature (#36721)

7 months agoudev/net: enable new [EnergyEfficientEthernet] section
Yu Watanabe [Wed, 12 Mar 2025 15:56:28 +0000 (00:56 +0900)] 
udev/net: enable new [EnergyEfficientEthernet] section

Also fixes a typo in setting name.

Follow-up for cdc9be29b1f4eefd5d384b0a9fed25675c66def5.
Addresses post-merge comments for #36302.

7 months agounits: order oomd after swap.target
Lennart Poettering [Wed, 12 Mar 2025 16:13:24 +0000 (17:13 +0100)] 
units: order oomd after swap.target

oomd only works well if we have swap, hence we should not start it
before swaps are up, in particular as we will print an annoying message
otherwise.

Fixes: #36704
7 months agotest: wrap assignments in ASSERT_OK() and friends with parentheses 36726/head
Yu Watanabe [Wed, 12 Mar 2025 20:07:54 +0000 (05:07 +0900)] 
test: wrap assignments in ASSERT_OK() and friends with parentheses

Hopefully fixes many CID reports.

7 months agotest-netlink: fix use of ASSERT_OK()
Yu Watanabe [Wed, 12 Mar 2025 20:11:11 +0000 (05:11 +0900)] 
test-netlink: fix use of ASSERT_OK()

Follow-up for 3841288e5f8583208550f8215443bf8da6080fd1.

7 months agohomed: fix OOM check
Yu Watanabe [Wed, 12 Mar 2025 19:55:34 +0000 (04:55 +0900)] 
homed: fix OOM check

Follow-up for f1b6417fea8ea1fb9a57f45b845ab1db944eca23.
Fixes CID#1593167.

7 months agohomectl: insert missing 'else'
Yu Watanabe [Wed, 12 Mar 2025 19:52:48 +0000 (04:52 +0900)] 
homectl: insert missing 'else'

Follow-up for cc14c14782d542b35fa12bfdadfd64ffa700cedf.
Fixes CID#1593168 and CID#1593166.