Commit Graph

82452 Commits

Author SHA1 Message Date
Luca Boccassi
a63f0ea73d test: allow to run test-local-addresses with IPv6 disabled by default, and assume RTA_VIA is always supported (#38039) 2025-07-03 09:58:02 +01:00
Yu Watanabe
34af1513d0 fuzz: avoid assertion for ExecContext.private_var_tmp triggered
Follow-up for 6156bec7a4.

Fixes #38037 and oss-fuzz#429112745.
2025-07-03 09:55:58 +01:00
Lennart Poettering
7ba5950307 logind: Don't match non-leader processes for utmp TTY determination (#38027)
This ensures we don't erroneously assign pseudoterminals created by
terminal emulators that use utempter to register themselves in utmp when
run under a GUI session that doesn't have a TTY assigned.
2025-07-03 09:20:19 +02:00
Yu Watanabe
3d38732179 test: assume RTA_VIA is supported
RTA_VIA support was added in kernel v5.2:
d15662682d

Our baseline on the kernel is v5.4. Hence, we can assume that the
attribute is supported.
2025-07-03 12:51:22 +09:00
Yu Watanabe
16eaed02bc test-local-addresses: enable IPv6 on the test interface
If IPv6 is disabled by default, we need to explicitly enable IPv6 on the
interface. Otherwise, adding an IPv6 address or route will fail.
2025-07-03 12:51:22 +09:00
Yu Watanabe
11ad2b7169 test-local-addresses: use ASSERT_OK() and friends 2025-07-03 12:51:22 +09:00
Yu Watanabe
381eefffc5 Fixes for vscode/intellisense parsing (#38040)
With these two changes the vscode parser works nicely again. Once the
EDG frontend adds support for this feature I'll fix it to check for the
fixed version like for GCC.
2025-07-03 12:46:57 +09:00
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
Myrrh Periwinkle
e523d9e9c4 logind: use manager_get_session_by_leader in manager_get_session_by_pidref 2025-07-03 09:16:22 +07: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](d498805e5c...0db433d412)

---
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
Luca Boccassi
e01ca3afdb macro: EDG compiler frontends doesn't support enum types
It declares STDC_VERSION 202311L but still doesn't support this feature:

https://en.cppreference.com/w/c/compiler_support/23

The EDG frontend is used by intellisense, which is the default
engine in VSCode, so parsing is currently broken and tons of
spurious errors are shown. Skip this feature when this
compiler frontend is used.

Follow-up for 92100f14c3
2025-07-03 01:24:17 +01:00
Luca Boccassi
942cb8a7c0 sd-common: do not fail preprocessor when intellisense is parsing the header
Just like coverity or clang analyzer, intellisense will parse _sd-common.h and
fail because of the #error so skip it like the others
2025-07-03 01:21:19 +01: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
Myrrh Periwinkle
1a088b564a logind: Don't match non-leader processes for utmp TTY determination
This ensures we don't erroneously assign pseudoterminals created by
terminal emulators that use utempter to register themselves in utmp when
run under a GUI session that doesn't have a TTY assigned.
2025-07-02 12:53:15 +07: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