Commit Graph

79019 Commits

Author SHA1 Message Date
Yu Watanabe
eb86b4e63b tree-wide: use hash ops with destructor (#36107) 2025-01-23 22:20:42 +09:00
Daan De Meyer
6733b07d43 mkosi: Add back --preserve-env when running integrationt tests
The test wrapper script depends on various github actions environment
variables so let's make sure those are propagated.
2025-01-23 12:18:21 +01:00
Yu Watanabe
38f7edd9d3 hashmap: drop hashmap_free_free() and friends 2025-01-23 18:22:53 +09:00
Yu Watanabe
58f0cd14a0 test: use hash ops with destructor 2025-01-23 18:22:53 +09:00
Yu Watanabe
06835cb397 remount-fs: use hash ops with destructor 2025-01-23 18:22:53 +09:00
Yu Watanabe
60cc858e9d exec-util: use hash ops with destructor 2025-01-23 18:22:52 +09:00
Yu Watanabe
04b7949ecf network: use hash ops with destructor 2025-01-23 18:22:47 +09:00
Yu Watanabe
938a6b49bd sd-journal: use hash ops with destructor 2025-01-23 18:19:28 +09:00
Yu Watanabe
2d23cadd19 journal-file: use hash ops with destructor
This also makes JournalFile.chain_cache allocated when necessary.
2025-01-23 18:19:28 +09:00
Yu Watanabe
b87501ea3c sd-bus: use hash ops with destructor
This also makes vtable_methods and vtable_properties managed by Set,
as the key and value of each entry are equivalent.
2025-01-23 18:19:28 +09:00
Yu Watanabe
4516022833 delta: use hash ops with destructor
This also makes it use RET_GATHER().
2025-01-23 18:19:28 +09:00
Yu Watanabe
c1bfee0bdb bootctl: use hash ops with destructor
This also makes the hashmap allocated when necessary.
2025-01-23 18:19:28 +09:00
Yu Watanabe
852c05c94f catalog: modernize code
- set destructors to catalog_hash_ops,
- acquire OrderedHashmap when necessary,
- gracefully handle NULL catalog directories and output stream,
- rename function output arguments,
- add many many assertions,
- use RET_GATHER().
2025-01-23 18:19:28 +09:00
Yu Watanabe
12006a7233 wait-online: use hash ops with destructor 2025-01-23 18:19:28 +09:00
Yu Watanabe
a22620e39f udev: use hash ops with destructor 2025-01-23 18:19:28 +09:00
Yu Watanabe
57f15d05bf udevadm-monitor: use hash ops with destructor
This also make it use STATIC_DESTRUCTOR_REGISTER() macro, and logs OOM
error.
2025-01-23 18:19:00 +09:00
Yu Watanabe
0284fcc0ab hash-funcs: introduce several basic hash_ops with value destructor 2025-01-23 18:15:42 +09:00
Andrew Sayers
e5038e63e9 Clarify that Conflicts= only applies when starting units
The "vice versa" in the old text could be interpreted as either
(wrong) "stopping the former will start the latter", or
(right) "starting the latter will stop the former".

Rephrase to avoid that ambiguity.
2025-01-23 18:14:47 +09:00
Yu Watanabe
90cf374e45 run: add --job-mode= argument (#34708)
systemctl has a --job-mode= argument, and adding the same argument to
systemd-run is useful for starting transient scopes with dependencies.
For example, if a transient scope BindsTo a service that is stopping,
specifying --job-mode=replace will wait for the service to stop before
starting it again, while the default job mode of "fail" will cause the
systemd-run invocation to fail.
2025-01-23 18:11:30 +09:00
Gavin Li
706a953504 run: add --job-mode= argument
systemctl has a --job-mode= argument, and adding the same argument to
systemd-run is useful for starting transient scopes with dependencies.
For example, if a transient scope BindsTo a service that is stopping,
specifying --job-mode=replace will wait for the service to stop before
starting it again, while the default job mode of "fail" will cause the
systemd-run invocation to fail.
2025-01-23 02:08:32 -05:00
Luca Boccassi
62e7b478ad pkg-config: add Requires.private: libcap
The two shared libraries for now link against libcap,
so add it to the Requires.private as it's a dependency

Fixes https://github.com/systemd/systemd/issues/36117
2025-01-23 10:28:47 +09:00
Yu Watanabe
b6b8148459 core/device: do not drop backslashes in SYSTEMD_WANTS=/SYSTEMD_USER_WANTS= (#35869)
Let consider the following udev rules:
```
PROGRAM="/usr/bin/systemd-escape foo-bar-baz", ENV{SYSTEMD_WANTS}+="test1@$result.service"
PROGRAM="/usr/bin/systemd-escape aaa-bbb-ccc", ENV{SYSTEMD_WANTS}+="test2@$result.service"
```
Then, a device expectedly gains a property:
```
SYSTEMD_WANTS=test1@foo\x2dbar\x2dbaz.service test2@aaa\x2dbbb\x2dccc.service
```
After the event being processed by udevd, PID1 processes the device, the
property previously was parsed with
`extract_first_word(EXTRACT_UNQUOTE)`, then the device unit gained the
following dependencies:
```
Wants=test1@foox2dbarx2dbaz.service test2@aaax2dbbbx2dccc.service
```
So both `%i` and `%I` for the template services did not match with the
original data, and it was hard to use `systemd-escape` in `PROGRAM=`
udev rule token.

This makes the property parsed with
`extract_first_word(EXTRACT_UNQUOTE|EXTRACT_RETAIN_ESCAPE)`, hence the
device unit now gains the following dependencies:
```
Wants=test1@foo\x2dbar\x2dbaz.service test2@aaa\x2dbbb\x2dccc.service
```
and `%I` for the template services match with the original data.

Fixes a bug caused by ceed8f0c8b (v233).

Fixes #16735.
Replaces #16737 and #35768.
2025-01-23 09:04:12 +09:00
Yu Watanabe
ef199874ae mkosi: Update to latest (#36114) 2025-01-23 09:00:39 +09:00
Yu Watanabe
af9e8ad4e8 pretty-print: fix handling of line continuation in cat_file() (#35886)
Fixes #35878.
2025-01-23 08:59:24 +09:00
Yu Watanabe
14887c14c6 network/ndisc: allow to configure route option preference (#35213)
Continuation of #35212.
Closes #35714.
2025-01-23 08:58:30 +09:00
Mike Yuan
7b940d8de9 core/job: never consider reload jobs redundant
Follow-up for 656bbffc6c

The commit reworked job merging logic so that reload jobs
won't get merged. However, they might get dropped from
transaction due to being deemed redundant, i.e. way before
it even hits job_install(). Let's make sure reload jobs
are always kept during transaction construction stage, too.
2025-01-22 22:51:46 +00:00
Luca Boccassi
f6eed063a6 mkosi: switch rootfs to ext4
btrfs is currently broken for nspawn on recent kernels, so switch
to the best filesystem until that is solved
2025-01-22 22:50:52 +00:00
Daan De Meyer
94558e6fc7 mkosi: Update to latest
With the latest mkosi, mkosi takes care of making sure it is
available within mkosi sandbox so we get rid of all the --preserve-env=
options when we invoke mkosi sandbox with sudo as these are not
required anymore. It also doesn't matter anymore if mkosi is installed
in /usr on the host so we get rid of the documentation around that as
well.
2025-01-22 22:25:51 +01:00
Daan De Meyer
007d255d87 mkosi: Run two more mkosi commands with sudo
Running some mkosi commands as root and other not can lead to cache
invalidations with the latest version, so make sure we run everything
as root after we've built the tools tree.
2025-01-22 22:25:51 +01:00
Luca Boccassi
338813351e udev-dump: also show written sysfs attributes and sysctl entries (#36091)
Split-out of #35968.
2025-01-22 20:56:31 +00:00
Luca Boccassi
60ca3caec6 OBS: switch to new top-level namespace (#36121)
https://build.opensuse.org/project/show/system:systemd
2025-01-22 20:50:44 +00:00
Luca Boccassi
a41f67b041 docs: mention packages in HACKING.md 2025-01-22 20:50:08 +00:00
Yu Watanabe
60ce6a3413 test-network: add test case for [IPv6RoutePrefix] Preference= 2025-01-22 20:48:31 +00:00
Yu Watanabe
fe9753841f network/radv: add [IPv6RoutePrefix] Preference= setting 2025-01-22 20:48:31 +00:00
Yu Watanabe
a10d6e0124 network/radv: modernize config_parse_router_preference() 2025-01-22 20:48:31 +00:00
Yu Watanabe
c1b7db56e5 udevadm-test: allow to specify extra directories to load udev rules files
This adds -D/--extra-rules-dir=DIR switch for 'udevadm test' command.
When specified, udev rules files in the specified directory will be also
loaded. This may be useful for debugging udev rules by copying some udev
rules files to a temporary directory.
2025-01-22 20:46:42 +00:00
Yu Watanabe
4fd81d03e2 rpm: mark udevd for reloading when an rules file is installed/updated
Then, we can avoid using udevadm (especially udev control socket) in
processing rpm.
2025-01-22 20:44:38 +00:00
Nick Rosbrook
16f99f5be9 udev: add systemd tag to devices tagged with security-device
This ensures that device units are created for these, which is
convenient for other units that want to declare dependencies on
such devices.
2025-01-22 21:43:44 +01:00
Yu Watanabe
41a1e3012e TEST-65-ANALYZE: add detailed test case for cat-config 2025-01-22 20:43:16 +00:00
Yu Watanabe
5e244e724f pretty-print: make cat_file() also highlight the trailing backslash for line continuation 2025-01-22 20:43:16 +00:00
Yu Watanabe
e27fb39e07 pretty-print: fix handling of line continuation in cat_file()
Fixes #35878.
2025-01-22 20:43:16 +00:00
Yu Watanabe
42b71eb94e pretty-print: cleanups for cat_file()
- add one missing assertion,
- always logs on error,
- simplify the logic to make it easy to understand,
- add several more comments.

Preparation for later commits. No functional change.
2025-01-22 20:43:16 +00:00
Lennart Poettering
af20b92b61 userdb: add comments to userdb varlink IDL 2025-01-22 21:42:14 +01:00
Lennart Poettering
347576ca8d machine-id-setup: actually unlink /run/machine-id if write/mount fails (#36105)
Follow-up for 64d52739c5

Fixes CID#1590374 and CID#1590375
2025-01-22 21:41:57 +01:00
Mike Yuan
9c039ef5ff pidfd-util: preferably acquire pidfd inode id through name_to_handle_at()
See rationales described in kernel commit:
b3caba8f7a
2025-01-22 21:41:44 +01:00
Lennart Poettering
cc524bc1fe userdb: two small fixes (#36115) 2025-01-22 21:41:28 +01:00
Lennart Poettering
593ad9746b fs-util: at_flags_normalize_nofollow() follow-up (#36116)
Just some extension to 6981203f3a
2025-01-22 21:41:14 +01:00
Yu Watanabe
4c9da4dc91 test: add test cases for parsing SYSTEMD_WANTS=/SYSTEMD_USER_WANTS= 2025-01-22 20:41:00 +00:00
Yu Watanabe
a467358b2a core/device: do not drop backslashes in SYSTEMD_WANTS=/SYSTEMD_USER_WANTS=
Let consider the following udev rules:
===
PROGRAM="/usr/bin/systemd-escape foo-bar-baz", ENV{SYSTEMD_WANTS}+="test1@$result.service"
PROGRAM="/usr/bin/systemd-escape aaa-bbb-ccc", ENV{SYSTEMD_WANTS}+="test2@$result.service"
===
Then, a device expectedly gains a property:
===
SYSTEMD_WANTS=test1@foo\x2dbar\x2dbaz.service test2@aaa\x2dbbb\x2dccc.service
===
After the event being processed by udevd, PID1 processes the device, the
property previously was parsed with extract_first_word(EXTRACT_UNQUOTE),
then the device unit gained the following dependencies:
===
Wants=test1@foox2dbarx2dbaz.service test2@aaax2dbbbx2dccc.service
===
So both '%i' and '%I' for the template services did not match with the original
data, and it was hard to use systemd-escape in PROGRAM= udev rule token.

This makes the property parsed with extract_first_word(EXTRACT_UNQUOTE|EXTRACT_RETAIN_ESCAPE),
hence the device unit now gains the following dependencies:
===
Wants=test1@foo\x2dbar\x2dbaz.service test2@aaa\x2dbbb\x2dccc.service
===
and '%I' for the template services match with the original data.

Fixes a bug caused by ceed8f0c8b (v233).

Fixes #16735.
Replaces #16737 and #35768.
2025-01-22 20:41:00 +00:00
Luca Boccassi
13871aa656 OBS: switch to new top-level namespace
https://build.opensuse.org/project/show/system:systemd
2025-01-22 20:34:04 +00:00