Commit Graph
84531 Commits
Author SHA1 Message Date
Yu Watanabe 8457f2a395 TEST-64-UDEV-STORAGE: generate debugging logs
Let's see if it provides something useful for debugging issue #39544.
2025-11-05 05:16:48 +09:00
Luca Boccassi 1e1f63e63b test: rework dmsetup test to wait for device to disappear
There might be a delay between an umount and a refcounted device
to disappear, so the test can be flaky:

[   36.107128] TEST-50-DISSECT.sh[1662]: ++ dmsetup ls
[   36.108314] TEST-50-DISSECT.sh[1663]: ++ grep loop
[   36.109283] TEST-50-DISSECT.sh[1664]: ++ grep -c verity
[   36.110284] TEST-50-DISSECT.sh[1360]: + test 1 -eq 1
[   36.111555] TEST-50-DISSECT.sh[1360]: + umount -R /tmp/TEST-50-IMAGES.hxm/mount
[   36.112237] TEST-50-DISSECT.sh[1668]: ++ dmsetup ls
[   36.113039] TEST-50-DISSECT.sh[1669]: ++ grep loop
[   36.113833] TEST-50-DISSECT.sh[1670]: ++ grep -c verity
[   36.114517] TEST-50-DISSECT.sh[1360]: + test 0 -eq 1
[   36.116734] TEST-50-DISSECT.sh[1000]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/TEST-50-DISSECT.dissect.sh failed'

https://github.com/systemd/systemd/actions/runs/19062162467/job/54444112653?pr=39540#logs

Switch to searching for the dm entry and check for it specifically,
and wait for it to disappear before checking that it is no longer
in the dm table.

Follow-up for 10fc43e504
2025-11-05 04:08:44 +09:00
Yu Watanabe 71d64f0527 core/service: reload fixlets (#39376)
Fixes https://github.com/systemd/systemd/issues/37515
2025-11-05 02:54:38 +09:00
Yu Watanabe d954161f9b core/exec-invoke: gracefully handle lack of privilege for initgroups() in user mode (#39039)
Fixes #39038
2025-11-05 02:53:05 +09:00
Yu Watanabe cfc7fd426d sysext: Check for /etc/initrd-release in given --root= tree (#39473) 2025-11-05 02:51:25 +09:00
Yu Watanabe 82b6dc1a17 sd-json: accept NULL path in sd_json_parse_file_at() too, port one manual fdopen() to it (#39538) 2025-11-05 01:40:27 +09:00
jouyouyun 2b8c7adbec cgls: print error messages when --unit and --user-unit are used together
Mixing the `--unit` and `--user-unit` options will result in error messages.
During the parsing phase, only the `arg_show_unit` record of the last
occurrence of the option is used; all names are placed in the same `arg_names`,
thus mixing the two types of units in the query.

For example, `-u foo --user-unit bar` will also treat `foo` as a user unit and
query it in the user service.
2025-11-05 01:38:18 +09:00
Chris Down a8c3ac6672 systemctl: Fix shutdown time parsing across DST changes
When parsing an absolute time specification like `hh:mm` for the
`shutdown` command, the code interprets a time in the past as "tomorrow
at this time". It currently implements this by adding a fixed 24-hour
duration (`USEC_PER_DAY`) to the timestamp.

This assumption breaks across DST transitions, as the day might not be
24 hours long. This can cause the shutdown to be scheduled at the wrong
time (typically off by one hour in either direction).

Change the logic to perform calendar arithmetic instead of timestamp
arithmetic. If the calculated time is in the past, we increment
`tm.tm_mday` and call `mktime_or_timegm_usec()` a second time.

This delegates all date normalization logic to `mktime()`, which
correctly handles all edge cases, including DST transitions, month-end
rollovers, and leap years.

Fixes: https://github.com/systemd/systemd/issues/39232
2025-11-05 01:36:47 +09:00
jouyouyun 05b880ac46 nss-myhostname: use FAMILY_ADDRESS_SIZE instead of the integer 16 when copying ip addr
To avoid copying extra characters when using IPv4.
2025-11-05 01:33:31 +09:00
Daan De Meyer 9d129ea34e machined/import: allow running in per-user mode (#38728) 2025-11-04 17:27:43 +01:00
Quentin Deslandes 6971798864 core: use proper service type of TEST-07-PID.user-namespace-path.sh
TEST-07-PID.user-namespace-path.sh is flaky as Type=simple is used
(implicitly), explicitly use Type=exec instead to ensure the namespaces
are created before starting another service reusing the same namespaces.

Fixes #39546.
2025-11-04 15:54:06 +00:00
Luca Boccassi 22311a1291 test: stop piping post-test journalctl commands to /failed
We can't see what the actual issues are when tests fail at that point, eg:

https://github.com/systemd/systemd/actions/runs/19034752357/job/54356278052
2025-11-04 15:53:23 +00:00
Lennart Poettering 9a1d72fe99 update TODO 2025-11-04 14:12:39 +01:00
Lennart Poettering 4248b02c44 test: add test case 2025-11-04 14:12:39 +01:00
Lennart Poettering 78a738f4cf tar-util: squash high UIDs in user mode 2025-11-04 14:12:39 +01:00
Lennart Poettering 4ded7f7a43 tar-util: add support for acls 2025-11-04 14:12:39 +01:00
Lennart Poettering e1e170feca tar-util: add support for file flags 2025-11-04 14:12:39 +01:00
Lennart Poettering a54f4520f3 tar-util: properly deal with sparse files
The extractor already deals with sparse files properly (because
archive_read_data_into_fd() does).

Let's also make sure the archiver also does this, and attaches the
necessary sparse file metadata to each file.
2025-11-04 14:12:39 +01:00
Lennart Poettering 63bf3ca8b0 tar-util: recognize hardlinks when generating tarballs 2025-11-04 14:12:39 +01:00
Lennart Poettering d4d94fceba tar-util: include xattrs in generated tarballs
We can already unpack them, let's pack them up to.
2025-11-04 14:12:39 +01:00
Lennart Poettering f89c914968 acl-util: add new acl_set_perm() helper 2025-11-04 14:12:39 +01:00
Kai Lueke 570eae5007 sysext: Check for /etc/initrd-release in given --root= tree
Both sysext and confext used the host's /etc/initrd-release file even
when --root=/somewhere was specified. A workaround was the
SYSTEMD_IN_INITRD= env var but without knowing this it was quite
confusing. Aside from users validating their extensions, the primary
use case for this to matter is when the extensions are set up from the
initrd where the initrd-release file is present when running but we want
to prepare the extensions for the final system and thus should match
for the right scope.
Make systemd-sysext check for /etc/initrd-release inside the given
--root= tree. An alternative would be to always ignore the
initrd-release check when --root= is passed but this way it is more
consistent. The image policy logic for EFI-loader-passed extensions
won't take effect when --root= is used, though.
2025-11-04 22:10:50 +09:00
Kai Lueke 6649562924 test: Add missing test cleanup for the last sysext test
The last sysext test leaked things into new tests added later,
uncovered by any new tests leftover check.
Remove the mutable folder state through a trap as done in other tests.
2025-11-04 22:10:18 +09:00
Lennart Poettering 030f239a19 varlink-idl: add infra to test our enum parsers against varlink IDL enums
In many cases we want to expose enums for which we have the usual
xyz_to_string()/xyz_from_string() via Varlink as enums. Let's add some
infra to test the tables against each other, to automatically detect
when they deviate.

In order to implement this properly, let's export/introduce clean
json_underscorefy()/json_dashify(), for dealing with the fact that our
enums usually use dash separates ames, but Varlink doesn't allow that.

(This does not add the test cases for all enum types we expose right
now, but only adds the general infra).
2025-11-04 11:46:17 +00:00
Mike Yuan ca8658120e TEST-80-NOTIFYACCESS: add test case for #37515 2025-11-04 12:18:34 +01:00
Mike Yuan b03e1b09af core/service: rework ExecReload= + Type=notify-reload interaction, add ExecReloadPost=
When Type=notify-reload got introduced, it wasn't intended to be
mutually exclusive with ExecReload=. However, currently ExecReload=
is immediately forked off after the service main process is signaled,
leaving states in between essentially undefined. Given so broken
it is I doubt any sane user is using this setup, hence I took a stab
to rework everything:

1.  Extensions are refreshed (unchanged)
2.  ExecReload= is forked off without signaling the process
3a. If RELOADING=1 is sent during the ExecReload= invocation,
    we'd refrain from signaling the process again, instead
    just transition to SERVICE_RELOAD_NOTIFY directly and
    wait for READY=1
3b. If not, signal the process after ExecReload= finishes
    (from now on the same as Type=notify-reload w/o ExecReload=)
4.  To accomodate the use case of performing post-reload tasks,
    ExecReloadPost= is introduced which executes after READY=1

The new model greatly simplifies things, as no control processes
will be around in SERVICE_RELOAD_SIGNAL and SERVICE_RELOAD_NOTIFY
states.

See also: https://github.com/systemd/systemd/issues/37515#issuecomment-2891229652
2025-11-04 12:18:33 +01:00
Mike Yuan b3c6709fde macro: add 21st case for IN_SET 2025-11-04 12:17:33 +01:00
Mike Yuan 48632305c7 man/org.freedesktop.systemd1: fix typo (ExecStop -> -Post) 2025-11-04 12:17:33 +01:00
Mike Yuan 1b4cf02ada core/service: fix missing error handling for refresh-extensions control process 2025-11-04 12:17:33 +01:00
Mike Yuan 5fb8387c67 core/service: reset all reload-related states once a cycle completes
Fixes #37515
2025-11-04 12:17:33 +01:00
Mike Yuan 584e89f26e core/service: consolidate where to initialize reload_result 2025-11-04 12:17:32 +01:00
Mike Yuan 98734ac74d core/service: forbid reverting STOPPING=1
We don't permit state transition from STOPPING back to RUNNING,
hence refrain from resetting notify_state too.
2025-11-04 12:17:32 +01:00
Mike Yuan ed834f11cb core/service: split out service_notify_message_process_state()
No functional change, preparation for later changes.
2025-11-04 12:17:32 +01:00
Mike Yuan 3d888e2dad core/service: add missing serialization for notify_state
This really should be persisted across daemon-reload since
it might contain deferred state transitions.
2025-11-04 12:17:32 +01:00
Mike Yuan 38ea58a907 core/service: remove effectively unused NOTIFY_UNKNOWN state
We usually use _INVALID enum value as placeholder.

While at it, reset notify_state in service_enter_dead() for consistency.
2025-11-04 12:17:31 +01:00
Mike Yuan 1b5a9a7d56 core/service: avoid duplicate unit_add_to_dbus_queue() call
If we're changing state anyways, service_set_state() -> unit_notify()
will take care of dbus signaling for us.
2025-11-04 12:17:31 +01:00
Mike Yuan 1b272d778a core/service: introduce SERVICE_STATE_WITH_WATCHDOG 2025-11-04 12:17:31 +01:00
Mike Yuan 1773d2a207 core: drop redundant pidref_done() calls
{service,socket}_unwatch_control_pid() -> unit_unwatch_pidref_done()
is unconditionally called everywhere.
2025-11-04 12:17:31 +01:00
Mike Yuan 16a0cbe915 core/service: merge service_enter_reload_mounting() into _refresh_extensions() 2025-11-04 12:17:31 +01:00
Mike Yuan 2e43eee666 core/service: restore spuriously changed comment
Not sure why dfdeb0b1cb
touched it at all.
2025-11-04 12:17:30 +01:00
Mike Yuan aebe553db3 core/service: do not set reload_begin_usec when refreshing confexts
reload_begin_usec is a barrier for determining whether RELOADING=1
came after the main process got signaled, unrelated to refreshing.
2025-11-04 12:17:30 +01:00
Mike Yuan af3a197515 core/service: no need for STATUS_TEXT_MAX to reside in header 2025-11-04 12:17:30 +01:00
Mike Yuan 969c8050d8 core/job: use UNIT_IS_* helpers 2025-11-04 12:17:30 +01:00
Mike Yuan b1947bf6e3 core/job: drop pure qualifier for static inline functions
The impl is directly visible to the compiler so it can apply
all sorts of optimizations wherever it sees fit. And with
the previous commit they are actually "const".
2025-11-04 12:17:29 +01:00
Mike Yuan 1fa9473b07 core/job: mark job_type_lookup_merge() and _is_redundant() as const
They don't take pointers, hence are eligible for stronger guarantees.
2025-11-04 12:17:29 +01:00
Quentin Deslandes 79dd24cf14 core: Add UserNamespacePath=
This allows a service to reuse the user namespace created for an
existing service, similarly to NetworkNamespacePath=. The configuration
is the initial user namespace (e.g. ID mapping) is preserved.
2025-11-04 10:55:04 +01:00
Mike Yuan d98c783516 sysupdated: port to sd_json_parse_file_at() 2025-11-04 10:46:01 +01:00
Mike Yuan 89b9a68e5f sd-json: accept NULL path in sd_json_parse_file_at() too 2025-11-03 22:32:57 +01:00
Mike Yuan eaebc33220 fileio: mask off O_NOFOLLOW in xfopenat_regular() for fd_reopen()
in a similar fashion as xopenat_full()
2025-11-03 22:32:25 +01:00
Zbigniew Jędrzejewski-Szmek 9218e4eacc mkosi: update fedora commit reference to 8e2833a5b64f7e2ce62ea0a2d0ec9e393e718dfa
* 8e2833a5b6 Automatically figure out the name of the top-level tar dir
* dffbf2beba Make sure fallback source is listed first
* 1d3b892105 Enable sysupdate and sysupdated
2025-11-03 13:31:22 +01:00