Commit Graph
82441 Commits
Author SHA1 Message Date
Yu Watanabe aada48970e udev-builtin-uaccess: open device node with O_PATH
Some device node refuses to be opened with read-write mode.
Let's not open with O_RDWR, but open with O_PATH, and use
FORMAT_PROC_FD_PATH().

Follow-up for 1abb592f2f.

Fixes #38033.
2025-07-03 12:46:35 +09:00
Yu Watanabe 9c9bf7e3fa core/transaction: minor tweaks for cyclic dependency logging (#38014) 2025-07-03 12:45:47 +09:00
Yu Watanabe 559d2c0349 meson: make -Wsequence-point warning critical
It detects e.g. multiple evaluations in macro.
2025-07-03 12:45:26 +09:00
dependabot[bot] 1422c7f017 build(deps): bump meson from 1.8.1 to 1.8.2 in /.github/workflows
Bumps [meson](https://github.com/mesonbuild/meson) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/1.8.1...1.8.2)

---
updated-dependencies:
- dependency-name: meson
  dependency-version: 1.8.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-03 10:40:38 +09:00
dependabot[bot] ce8000d341 build(deps): bump redhat-plumbers-in-action/advanced-issue-labeler
Bumps [redhat-plumbers-in-action/advanced-issue-labeler](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler) from 3.2.0 to 3.2.2.
- [Release notes](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler/releases)
- [Commits](https://github.com/redhat-plumbers-in-action/advanced-issue-labeler/compare/d498805e5c7c0658e336948b3363480bcfd68da6...0db433d412193574252480b4fc22f2e4319a4ea3)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/advanced-issue-labeler
  dependency-version: 3.2.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-03 10:39:46 +09:00
Yaping Li 130ecc3bdd test-xattr-util.c: migrate to new assertion macros (#38025)
We recently added a new set of assertion macros such as ASSERT_GE,
ASSERT_OK, ASSERT_EQ, ... which show not only the expression that failed
but also the values of the arguments of the expression. Let's use them.
2025-07-03 09:06:04 +09:00
Yu Watanabe 5056d8332e test: improve printing of assertion errors, allow more failures (#38004) 2025-07-03 09:01:22 +09:00
Yu Watanabe 33527a9b0c test-dns-search-domain: several cleanups
- use STRV_MAKE() macro,
- add several missing assertions,
- use more suitable ASSERT_XYZ() macros,
- drop TEST(dns_search_domain_unlink_all), as it is already tested in
  TEST(dns_search_domain_new_system_limit).
2025-07-03 08:46:26 +09:00
DaanDeMeyer 84d878ca27 userdbctl: Fix error handling 2025-07-03 08:44:47 +09:00
Yu Watanabe 878c373370 NEWS: fix typo 2025-07-03 06:57:23 +09:00
Yu Watanabe 283bf66081 core/socket: introduce DeferTrigger= (#37505)
Follow-up for #37222 and #37421
2025-07-03 06:33:23 +09:00
Lennart Poettering 89e83aada8 pcrlock: include pcrlock features in exit status
Fixes: #38019
2025-07-02 22:43:35 +02:00
Lennart Poettering 0f2c5848b2 logind: pick up tty info from utmp only for tty sessions (#38034)
Alternative for: #38027
2025-07-02 22:42:56 +02:00
Lennart Poettering 2c8f502fc8 update NEWS with even more features for v258 2025-07-02 18:21:19 +02:00
Lennart Poettering bd578c2d66 logind: pick up tty info from utmp only for tty sessions
Let's tighten the rules for picking up TTY information from utmp: let's
do so only for TTY session, nothing else. Apparently people have issues
with graphical sessions with certain terminal emulators that install
entries in utmp for each emulator window.

Alternative for: #38027
2025-07-02 16:25:42 +02:00
Lennart Poettering d3f04a6fa5 logind: use memdup_suffix0() where appropiate
memdup_suffix0() is the call of choice when we are dealing with an input
that might not be NUL terminated. strndup() assumes NUL termination.
2025-07-02 16:25:06 +02:00
peelz 7c8070c781 zsh: remove _files prefixes
Prefixes would be nice, but they appear to be very buggy.

A few examples:
- `udevadm test-builtin net_setup_link /sys<TAB><TAB>`: `/sysblock/`
- `udevadm test-builtin net_setup_link /sys/<TAB><TAB>`: `/sys/bin/`
- `journalctl /dev<TAB>`: `/dev//dev/`
2025-07-02 12:48:42 +01:00
Zbigniew Jędrzejewski-Szmek 6b60354656 tests: print errno name rather than the message
The tests are written and consumed by developers. Errno descriptions are good
for users, but for developers the errno "name" is actually more useful, and
we need to always map the description back to the name to compare with the
code. Let's make things simpler for ourselves by printing the errno names
directly.

Example output:

src/test/test-tests.c:15: Assertion failed: Expected "-1" to succeed, but got error: -1/EPERM
src/test/test-tests.c:16: Assertion failed: Expected "-ENOANO" to succeed, but got error: -55/ENOANO
src/test/test-tests.c:20: Assertion failed: Expected "0" to be positive, but it is zero.
src/test/test-tests.c:62: Assertion failed: Expected "RET_NERRNO(mkdir("/i/will/fail/with/enoent", 666))" to fail with error -55/ENOANO, but got -2/ENOENT
src/test/test-tests.c:68: Assertion failed: Expected "0" to fail with errno 2/ENOENT, but it succeeded
src/test/test-tests.c:70: Assertion failed: Expected "mkdir("/i/will/fail/with/enoent", 666)" to fail with errno 55/ENOANO, but got 2/ENOENT
2025-07-01 17:53:22 +02:00
Zbigniew Jędrzejewski-Szmek 6020ca2c23 basic/errno-list: add helper to print errno names 2025-07-01 17:51:49 +02:00
Zbigniew Jędrzejewski-Szmek 2d39c99fd8 test-cgroup-util: print info about process before asserting
If this tests ever fails again, we should have at least a chance
to figure out what went wrong.
2025-07-01 17:51:49 +02:00
Zbigniew Jędrzejewski-Szmek 145100836e test-cgroup-util: ignore -ENXIO in more places
In https://github.com/systemd/systemd/pull/38003, one test failed:
Unit tests / build (CLANG_ASAN_UBSAN):
src/test/test-cgroup-util.c:237: Assertion failed: Expected "r" to succeed, but got error: No such device or address

Checks for specific errors were added in ca82f0cbe2,
partially relaxed in e92d699dde.
cg_pidref_get_unit() and cg_pid_get_slice() enter a deep chain of calls,
so it's hard to guess where the failure occurred. But those two calls
expect the cgroup path to be "well formed". When we're running in CI,
we don't have full control over what is happening on the machine,
so let's suppress that error too.
2025-07-01 17:51:49 +02:00
Zbigniew Jędrzejewski-Szmek 83e0e32944 test-cgroup-util: minor simplification 2025-07-01 17:51:49 +02:00
Zbigniew Jędrzejewski-Szmek ea64d55080 tests: use new ASSERT_OK_OR macro 2025-07-01 17:51:49 +02:00
Zbigniew Jędrzejewski-Szmek 367b325554 tests: add new ASSERT_OK_OR macro
IN_SET() fails if __VA_ARGS__ is just one item. I inserted a bogus 0 item into
the check to work around this.
2025-07-01 17:51:49 +02:00
Zbigniew Jędrzejewski-Szmek 0adbb11b4e tests: print numeric error value too on failure
The error message is not always meaningful. Also, sometimes we care about the
sign of the value, and we ignore the sign of the error in the printing machinery.

The messages for errno are changed to say "errno" instead of "error". The problem with
the previous formalation is that our errors are always negative and errnos are
positive, so when we print the numerical value, we cannot use the word for both.

Example output:
src/test/test-tests.c:15: Assertion failed: Expected "-1" to succeed, but got error: -1/Operation not permitted
src/test/test-tests.c:16: Assertion failed: Expected "-ENOANO" to succeed, but got error: -55/No anode
src/test/test-tests.c:61: Assertion failed: Expected "0" to fail with error -2/"No such file or directory", but it succeeded
src/test/test-tests.c:62: Assertion failed: Expected "RET_NERRNO(mkdir("/i/will/fail/with/enoent", 666))" to fail with error -55/"No anode", but got the following error: -2/No such file or directory
src/test/test-tests.c:68: Assertion failed: Expected "0" to fail with errno 2/"No such file or directory", but it succeeded
src/test/test-tests.c:70: Assertion failed: Expected "mkdir("/i/will/fail/with/enoent", 666)" to fail with errno 55/"No anode", but got the following errno: 2/No such file or directory
2025-07-01 17:51:49 +02:00
Zbigniew Jędrzejewski-Szmek 236f7ab07c tests: cast to intmax_t instead of printing to a temp buffer
We can do this for int types, i.e. the variants where we expect a
success/error code. The macros which do generating comparison operations
also support floats so we shouldn't use intmax_t there.

The code is shorter and calling printf once is certainly more efficient.
2025-07-01 17:51:49 +02:00
Zbigniew Jędrzejewski-Szmek a1296fa5e5 test-tests: move assert tests to new file
Those macros are defined in tests.[ch], so the tests should be in test-tests.c.
2025-07-01 17:51:46 +02:00
Zbigniew Jędrzejewski-Szmek 89181651e6 shared/tests: indent defines 2025-07-01 17:47:34 +02:00
Vitaly Kuznetsov 821b453170 man/systemd-sysext: list ephemeral/ephemeral-import in the list of options
ephemeral/ephemeral-import are described as possible '--mutable' options but
not present in the list. Note, "systemd-sysext --help" lists them correctly.
2025-06-30 18:03:07 +01:00
Mike Yuan 6912eb315f core/transaction: be explicit about cyclic ordering relationship
Inspired by https://github.com/systemd/systemd/pull/35417#discussion_r1867868221
2025-06-30 17:58:05 +02:00
Mike Yuan 3aa5e91b1e core/transaction: use strextendf_with_separator() where appropriate 2025-06-30 17:58:05 +02:00
Mike Yuan 1cce8cbf63 core/transaction: inline one iterator var 2025-06-30 17:58:04 +02:00
Mike Yuan 1c8d653d2b core/transaction: do not attempt to log "n/a" as a journal field
Follow-up for 3cf6a3a3d4
2025-06-30 17:58:04 +02:00
Daan De Meyer 86e780759d test-xml: Use ASSERT_OK() instead of ASSERT_GE()
Follow up for 7a58b45017
2025-06-30 15:49:11 +01:00
Mike Yuan c950bb3bd7 TEST-07-PID1: add test cases for DeferTrigger= 2025-06-30 13:10:43 +02:00
Mike Yuan a2b34106e7 units/systemd-{udevd,journald}*.socket: enable DeferTrigger=
Refer to d766c75acd for the rationale
behind the udevd change.

systemd-journald.service conflicts with soft-reboot.target,
so make sure anything surviving soft-reboot and trying
to log to journal doesn't fail the socket units.
2025-06-30 13:10:43 +02:00
Mike Yuan 1b4ab5a209 core/socket: introduce DeferTrigger= and DeferTriggerMaxSec=
Alternative to b50f6dbe57

The commit naively returned early from socket_enter_running(), which however
is quite problematic, as the socket will be woken up over and over again
without doing a thing, until we eventually hit Poll/TriggerLimit*=.
On top of that it requires hacks to hold the start job for initrd-switch-root.service
up. Overall I doubt that is the right approach.

Let's instead hook this into our job engine, and try to activate
the service again when some other units are stopped. If all installed
jobs have been run yet we're still seeing the conflict or the manually
selected timeout is reached, fail the socket as before.
2025-06-30 13:10:43 +02:00
Mike Yuan 1b9400f2ee core/transaction: add job mode "lenient" as an even weaker version of _FAIL 2025-06-30 13:10:42 +02:00
Mike Yuan 286c61732f units/initrd-cleanup.service: drop --job-mode=replace-irreversibly hack
This partially reverts d766c75acd.

The offending commit tries to block systemd-udevd.service
from being activated during switch-root, but it is a dirty hack
and causes problems with e.g. Ctrl-Alt-Delete handling which
actually need to start a conflicting target. Let's revert
this here, and the original issue will be resolved in a cleaner
fashion in later commits.
2025-06-30 13:10:28 +02:00
Jim Spentzos 3725e17408 po: Translated using Weblate (Greek)
Currently translated at 35.7% (92 of 257 strings)

Co-authored-by: Jim Spentzos <jimspentzos2000@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/el/
Translation: systemd/main
2025-06-30 20:05:44 +09:00
Mike Yuan 7707eb8fc2 core/socket: use ERROR_IS_NEG_* at one more place 2025-06-30 12:44:54 +02:00
Mike Yuan 7732cecb1e core/unit: correct indentation
Follow-up for 54e1f676a2
2025-06-30 12:44:52 +02:00
Nick Labich a9e860f22e nspawn: Add --bind-user-shell= to control shells for --bind-user
Prior to this change, no user shell can be specified in the user
records passed into a container via --bind-user=. This new option
allows users to:

1. When false (the default), continue to specify no user shell for
   each bound user record, resulting in the use of the container's
   default shell for bound users.

2. When true, include each host user's shell in the corresponding
   user record passed into a container (via --bind-user=).

3. When an absolute path, set that path as the user shell for each
   user record passed into a container (via --bind-user=).

This does not change the existing behavior, but allows users to
opt-in to either copy the shells specified by the host user records
or override the shell explicitly by path.
2025-06-30 10:45:10 +02:00
Michael Ferrari 381304a209 repart: add support for Format=empty
This is a new meta value for the `Format=` option, which is equivalent
as specifying `Label=_empty` and `NoAuto=1` for compatibility with
sd-sysupdate.

Closes: https://github.com/systemd/systemd/issues/34596
2025-06-30 10:11:16 +02:00
Nick Labich 878c2b28df vmspawn: Use host_device driver for --extra-drive block devices
Extra drives attached to VMs use the file driver for regular files and the
host_device driver for block devices.

Fixes https://github.com/systemd/systemd/issues/37986
2025-06-30 10:08:30 +02:00
Yu Watanabe 4f18ff2e29 tree-wide: include unistd.h where necessary
We use symbols provided by unistd.h without including it. E.g.
open(), close(), read(), write(), access(), symlink(), unlink(), rmdir(),
fsync(), syncfs(), lseek(), ftruncate(), fchown(), dup2(), pipe2(),
getuid(), getgid(), gettid(), getppid(), pipe2(), execv(), _exit(),
environ, STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO, F_OK, and their
friends and variants, so on.

Currently, unistd.h is indirectly included mainly in the following two paths:
- through missing_syscall.h, which is planned to covert to .c file.
- through signal.h -> bits/sigstksz.h, which is new since glibc-2.34.
  Note, signal.h is included by sd-eevent.h. So, many source files
  indirectly include unistd.h if newer glibc is used.

Currently, our baseline on glibc is 2.31. We need to support glibc older
than 2.34, but unfortunately, we do not have any CI environments with
such old glibc. CIFuzz uses glibc-2.31, but it builds only fuzzers, and
many files are even not compiled.
2025-06-30 09:19:15 +02:00
Yu Watanabe b9c344b5c0 conf-files: several follow-ups for #37972 (#37997)
The PR #37972 was merged without final review by mistake, and has
several issues.
This reverts some of the commits in the PR, and fix several issues.
2025-06-30 12:47:49 +09:00
Yu Watanabe bb60dd27a6 TEST-17-UDEV: check the exit code at last
Otherwise, it is hard to debug when the test failed.
2025-06-30 05:35:13 +09:00
Yu Watanabe 9000db5f6e conf-files: fix an empty root handling in conf_files_list_strv()
Before 50c81130b6, the function used
chase(), hence if root is an empty string, each config directory made
prefixed with the current working directory if it is relative. See
implementation of chase().

With 50c81130b6, conf_files_list_strv()
internally uses chaseat(), hence each config directory is not prefixed
anymore even if it is relative.

To restore the previous behavior, this makes
- if root is an empty string, prefix each config directories with the
  current working directory if relative.
- if root is relative, make it absolute to make the prefixed results also
  absolute, and debugging logs show absolute paths.
- use chaseat_prefix_root() to prefix the results, for safety.

Follow-ups for 50c81130b6.
2025-06-30 05:35:03 +09:00
Yu Watanabe 8ce463639a path-util: move empty_or_root_to_null() from chase.c
And rename it to empty_or_root_harder_to_null(), as it also checks if
the input path effectively points to the root by calling path_is_root().
This also adds simple test cases for the function.
2025-06-30 03:45:29 +09:00