]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
9 months agoupdate TODO 36010/head
Lennart Poettering [Wed, 15 Jan 2025 08:44:52 +0000 (09:44 +0100)] 
update TODO

9 months agotest: add test case for tmpfs quota logic + PAMName= ask-password logic
Lennart Poettering [Tue, 14 Jan 2025 23:25:22 +0000 (00:25 +0100)] 
test: add test case for tmpfs quota logic + PAMName= ask-password logic

9 months agohomectl: add support for configuring tmpfs limits
Lennart Poettering [Fri, 10 Jan 2025 14:31:44 +0000 (15:31 +0100)] 
homectl: add support for configuring tmpfs limits

9 months agouser-runtime-dir: enforce /tmp/ and /dev/shm/ quota
Lennart Poettering [Fri, 10 Jan 2025 10:34:18 +0000 (11:34 +0100)] 
user-runtime-dir: enforce /tmp/ and /dev/shm/ quota

Enforce the quota on these two tmpfs at the same place where we mount
the per-user $XDG_RUNTIME_DIR. Conceptually these are very similar
concepts, and it makes sure to enforce the limits at the same place with
the same lifecycle.

9 months agouser-runtime-dir: some smaller modernizations/refactorings
Lennart Poettering [Thu, 23 Jan 2025 21:30:41 +0000 (22:30 +0100)] 
user-runtime-dir: some smaller modernizations/refactorings

9 months agouser-record: add fields for setting limits on /tmp/ and /dev/shm/
Lennart Poettering [Fri, 10 Jan 2025 10:33:59 +0000 (11:33 +0100)] 
user-record: add fields for setting limits on /tmp/ and /dev/shm/

9 months agodevnum-util: add macros to safely convert dev_t to pointers and back
Lennart Poettering [Thu, 23 Jan 2025 10:40:36 +0000 (11:40 +0100)] 
devnum-util: add macros to safely convert dev_t to pointers and back

Sometimes it's nice being able to store dev_t as pointer values in
hashmaps/tables, instead of having to allocate memory for them and using
devt_hash_ops. After all dev_t is weird on Linux/glibc: glibc defines it
as 64bit entity (which hence appears as something we cannot encode in a
pointer value for compat with 32bit archs) but it actually is 32bit in
the kernel apis. Hence we can safely cut off the upper 32bit, and still
retain compat with all archs.

But let's hide this in new macros, and validate this is all correct via
a test.

9 months agodocs: mention the two other userdb services we ship these days
Lennart Poettering [Thu, 23 Jan 2025 14:21:36 +0000 (15:21 +0100)] 
docs: mention the two other userdb services we ship these days

9 months agoudev-rules: check OWNER/GROUP= setting more strictly (#36123)
Yu Watanabe [Thu, 23 Jan 2025 20:09:39 +0000 (05:09 +0900)] 
udev-rules: check OWNER/GROUP= setting more strictly (#36123)

- refuses lines with unknown or invalid user/group,
- refuses non-system user/group in the setting.

9 months agocreds: permit interactive polkit auth when encrypting/decrypting through IPC
Mike Yuan [Wed, 22 Jan 2025 17:25:17 +0000 (18:25 +0100)] 
creds: permit interactive polkit auth when encrypting/decrypting through IPC

9 months agocore/job: fix typo
Mike Yuan [Thu, 23 Jan 2025 17:02:34 +0000 (18:02 +0100)] 
core/job: fix typo

9 months agoNEWS: mention OWNER=/GROUP= in udev rules now refuses non-system user/group 36123/head
Yu Watanabe [Thu, 23 Jan 2025 17:33:05 +0000 (02:33 +0900)] 
NEWS: mention OWNER=/GROUP= in udev rules now refuses non-system user/group

9 months agotest: add test cases for OWNER=/GROUP= with non-system user/group
Yu Watanabe [Thu, 23 Jan 2025 00:13:38 +0000 (09:13 +0900)] 
test: add test cases for OWNER=/GROUP= with non-system user/group

9 months agoudev-rules: ignore non-system user/group in OWNER=/GROUP=
Yu Watanabe [Wed, 22 Jan 2025 21:08:23 +0000 (06:08 +0900)] 
udev-rules: ignore non-system user/group in OWNER=/GROUP=

Recently, we introduce 'clock' system group, and set it for rtc/ptp
devices. See af96ccfc24bc4803078a46b4ef2cdeb5decdfbcd.

However, if non-system group with the same name is already exist,
previously the devices were owned by the non-system group. That may
possibly happen on updating systemd.

Let's avoid accidentally devices being owned by non-system user/group.

9 months agoudev-rules: ignore OWNER=/GROUP= with unknown user/group
Yu Watanabe [Wed, 22 Jan 2025 20:59:04 +0000 (05:59 +0900)] 
udev-rules: ignore OWNER=/GROUP= with unknown user/group

Previously, when an unknown or invalid user/group is specified,
a token was installed with UID_INVALID/GID_INVALID. That's not only
meaningless in most cases, but also clears previous assignment,
if multiple OWNER=/GROUP= token exist for the same device, e.g.

KERNEL=="sda", GROUP="disk"
KERNEL=="sda", GROUP="nonexistentuser"

This makes when an unknown user/group is specified, the line will be
ignored. Hence, in the above example, the device will be owned by the
group "disk".

9 months agoudev-rules: get_user_creds()/get_group_creds() return -ESRCH when user/group does...
Yu Watanabe [Thu, 23 Jan 2025 17:16:36 +0000 (02:16 +0900)] 
udev-rules: get_user_creds()/get_group_creds() return -ESRCH when user/group does not exist

This drops -ENOENT error check for get_user_creds()/get_group_creds(),
as nowadays they always return -ESRCH when the specified user/groups
cannot be found.

This also adds short comments for NULL arguments.

9 months agounits: modprobe@.service tweaks (#36132)
Lennart Poettering [Thu, 23 Jan 2025 17:18:10 +0000 (18:18 +0100)] 
units: modprobe@.service tweaks (#36132)

9 months agosd-device: chase sysattr and refuse to read/write outside of sysfs (#36004)
Yu Watanabe [Thu, 23 Jan 2025 16:58:19 +0000 (01:58 +0900)] 
sd-device: chase sysattr and refuse to read/write outside of sysfs (#36004)

9 months agoudevadm: introduce cat command to show udev rules (#35893)
Yu Watanabe [Thu, 23 Jan 2025 16:49:42 +0000 (01:49 +0900)] 
udevadm: introduce cat command to show udev rules (#35893)

Closes #35818.

9 months agounits: don't load squasfs/erofs kmods explicitly 36132/head
Lennart Poettering [Thu, 23 Jan 2025 13:49:46 +0000 (14:49 +0100)] 
units: don't load squasfs/erofs kmods explicitly

File system modules should be something the kernel can autoload
automatically, and according to my testing that works fine, hence let's
drop the explicit deps, in particular as systems usually stick to one fs
for these things, not both.

I inquired bluca about the reason to add it, and didn't remember
anymore, and was fine with me removing this. So let's remove this for
now, should issues arise we can revert this.

9 months agounits: mountfsd needs to pull DM and loop kmods
Lennart Poettering [Thu, 23 Jan 2025 13:47:10 +0000 (14:47 +0100)] 
units: mountfsd needs to pull DM and loop kmods

mountfsd is supposed to be available during early boot aleady, before
systemd-tmpfiles-setup-dev-early.service completes, hence make sure
loopback devices and DM already work before that.

As suggested by yuwata here:

https://github.com/systemd/systemd/pull/35685#issuecomment-2608157569

9 months agounits: add a longer comment to modprobe@.service explaining when to use it
Lennart Poettering [Thu, 23 Jan 2025 13:47:03 +0000 (14:47 +0100)] 
units: add a longer comment to modprobe@.service explaining when to use it

9 months agosd-device: use device_in_subsystem() at more places 36004/head
Yu Watanabe [Sat, 18 Jan 2025 01:41:06 +0000 (10:41 +0900)] 
sd-device: use device_in_subsystem() at more places

9 months agosd-device: use specific setters for read entries from uevent file
Yu Watanabe [Sat, 18 Jan 2025 01:40:32 +0000 (10:40 +0900)] 
sd-device: use specific setters for read entries from uevent file

Previously, if e.g. DRIVER=foo is specified in uevent file, the value is
only saved as property, but was not set to sd_device.driver.
That was inconsistent to the case when a device is created through
netlink uevent.

Let's always set when we get e.g. sd_device.driver when DRIVER=foo
from both uevent file and netlink uevent.

9 months agosd-device: use sd_device_get_sysattr_value() to read uevent file
Yu Watanabe [Sat, 18 Jan 2025 01:39:21 +0000 (10:39 +0900)] 
sd-device: use sd_device_get_sysattr_value() to read uevent file

This also replaces the custom parser with strv_split_newlines_full().
No functional change, just refactoring.

9 months agosd-device: use sd_device_get_sysattr_value() to read special symlinks
Yu Watanabe [Sat, 18 Jan 2025 01:33:19 +0000 (10:33 +0900)] 
sd-device: use sd_device_get_sysattr_value() to read special symlinks

Then, cached result may be used. No functional change, just refactoring.

9 months agosd-device: chase sysattr and refuse to read/write files outside of sysfs
Yu Watanabe [Sat, 11 Jan 2025 22:03:49 +0000 (07:03 +0900)] 
sd-device: chase sysattr and refuse to read/write files outside of sysfs

This makes sd_device_get_sysattr_value()/sd_device_set_sysattr_value()
refuse to read/write files outside of sysfs for safety.

Also this makes
- use chase() to resolve and open the symlink in path to sysfs attribute,
- use delete_trailing_chars(),
- include error code in cache entry, so we can cache more error cases,
- refuse caching value written to uevent file of any devices, i.e.
  sd_device_set_sysattr_value(dev, "../uevent", "add") will also not
  cache the value "add".

9 months agofileio: make read_virtual_file_at() accept O_PATH file descriptor
Yu Watanabe [Fri, 17 Jan 2025 21:45:03 +0000 (06:45 +0900)] 
fileio: make read_virtual_file_at() accept O_PATH file descriptor

Then, merge read_virtual_file_at() and read_virtual_file_fd(), and make
the latter inline.

9 months agofileio: make write_string_file_at() accept O_PATH fd and an empty filename
Yu Watanabe [Fri, 17 Jan 2025 21:43:12 +0000 (06:43 +0900)] 
fileio: make write_string_file_at() accept O_PATH fd and an empty filename

Then, introduce an inline wrapper write_string_file_fd().

9 months agofileio: fix verification on failure in write_string_file_full()
Yu Watanabe [Fri, 17 Jan 2025 21:36:31 +0000 (06:36 +0900)] 
fileio: fix verification on failure in write_string_file_full()

Fixes a bug introduced by 0ab5e2a4b4f5d435cb66b591ef5c700894663fd3.

9 months agoudevadm: introduce cat command 35893/head
Yu Watanabe [Tue, 7 Jan 2025 07:58:37 +0000 (16:58 +0900)] 
udevadm: introduce cat command

This introduces 'udevadm cat' command, that shows udev rules files or
udev.conf, which may be useful for debugging.

Closes #35818.

9 months agobash-completion/udevadm-verify: suggest found udev rules files
Yu Watanabe [Thu, 9 Jan 2025 10:25:49 +0000 (19:25 +0900)] 
bash-completion/udevadm-verify: suggest found udev rules files

This also fixes the issue that no suggestion is provided after a standalone
option is specified.

9 months agoudevadm-verify: chase specified paths
Yu Watanabe [Thu, 9 Jan 2025 01:27:11 +0000 (10:27 +0900)] 
udevadm-verify: chase specified paths

Also, when a filename is specified, also search udev rules file in
udev/rules.d directories.

This also refuses non-existing files, and file neither nor a regular
nor a directory, e.g. /dev/null.

9 months agoudev-rules: log the first line number when continued
Yu Watanabe [Fri, 10 Jan 2025 18:45:38 +0000 (03:45 +0900)] 
udev-rules: log the first line number when continued

9 months agoudev: sort builtins
Yu Watanabe [Tue, 7 Jan 2025 08:41:41 +0000 (17:41 +0900)] 
udev: sort builtins

Then, 'udevadm test-builtin --help' lists builtins alphabetically.

9 months agoshell-completion/udevadm: add net_driver
Yu Watanabe [Tue, 7 Jan 2025 08:39:12 +0000 (17:39 +0900)] 
shell-completion/udevadm: add net_driver

Follow-up for 2b5b25f123ceb89b3ff45b2380db1c8a88b046d9.

9 months agotree-wide: use hash ops with destructor (#36107)
Yu Watanabe [Thu, 23 Jan 2025 13:20:42 +0000 (22:20 +0900)] 
tree-wide: use hash ops with destructor (#36107)

9 months agomkosi: Add back --preserve-env when running integrationt tests
Daan De Meyer [Thu, 23 Jan 2025 09:35:06 +0000 (10:35 +0100)] 
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.

9 months agohashmap: drop hashmap_free_free() and friends 36107/head
Yu Watanabe [Wed, 22 Jan 2025 02:37:06 +0000 (11:37 +0900)] 
hashmap: drop hashmap_free_free() and friends

9 months agotest: use hash ops with destructor
Yu Watanabe [Wed, 22 Jan 2025 02:10:10 +0000 (11:10 +0900)] 
test: use hash ops with destructor

9 months agoremount-fs: use hash ops with destructor
Yu Watanabe [Wed, 22 Jan 2025 01:51:13 +0000 (10:51 +0900)] 
remount-fs: use hash ops with destructor

9 months agoexec-util: use hash ops with destructor
Yu Watanabe [Wed, 22 Jan 2025 01:49:07 +0000 (10:49 +0900)] 
exec-util: use hash ops with destructor

9 months agonetwork: use hash ops with destructor
Yu Watanabe [Wed, 22 Jan 2025 01:46:09 +0000 (10:46 +0900)] 
network: use hash ops with destructor

9 months agosd-journal: use hash ops with destructor
Yu Watanabe [Wed, 22 Jan 2025 01:39:35 +0000 (10:39 +0900)] 
sd-journal: use hash ops with destructor

9 months agojournal-file: use hash ops with destructor
Yu Watanabe [Tue, 21 Jan 2025 22:24:03 +0000 (07:24 +0900)] 
journal-file: use hash ops with destructor

This also makes JournalFile.chain_cache allocated when necessary.

9 months agosd-bus: use hash ops with destructor
Yu Watanabe [Tue, 21 Jan 2025 21:29:23 +0000 (06:29 +0900)] 
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.

9 months agodelta: use hash ops with destructor
Yu Watanabe [Tue, 21 Jan 2025 21:06:38 +0000 (06:06 +0900)] 
delta: use hash ops with destructor

This also makes it use RET_GATHER().

9 months agobootctl: use hash ops with destructor
Yu Watanabe [Tue, 21 Jan 2025 20:41:37 +0000 (05:41 +0900)] 
bootctl: use hash ops with destructor

This also makes the hashmap allocated when necessary.

9 months agocatalog: modernize code
Yu Watanabe [Tue, 21 Jan 2025 20:24:35 +0000 (05:24 +0900)] 
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().

9 months agowait-online: use hash ops with destructor
Yu Watanabe [Wed, 22 Jan 2025 02:08:25 +0000 (11:08 +0900)] 
wait-online: use hash ops with destructor

9 months agoudev: use hash ops with destructor
Yu Watanabe [Wed, 22 Jan 2025 02:08:07 +0000 (11:08 +0900)] 
udev: use hash ops with destructor

9 months agoudevadm-monitor: use hash ops with destructor
Yu Watanabe [Tue, 21 Jan 2025 19:15:49 +0000 (04:15 +0900)] 
udevadm-monitor: use hash ops with destructor

This also make it use STATIC_DESTRUCTOR_REGISTER() macro, and logs OOM
error.

9 months agohash-funcs: introduce several basic hash_ops with value destructor
Yu Watanabe [Tue, 21 Jan 2025 21:05:53 +0000 (06:05 +0900)] 
hash-funcs: introduce several basic hash_ops with value destructor

9 months agoClarify that Conflicts= only applies when starting units
Andrew Sayers [Thu, 23 Jan 2025 08:06:57 +0000 (08:06 +0000)] 
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.

9 months agorun: add --job-mode= argument (#34708)
Yu Watanabe [Thu, 23 Jan 2025 09:11:30 +0000 (18:11 +0900)] 
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.

9 months agorun: add --job-mode= argument 34708/head
Gavin Li [Thu, 10 Oct 2024 20:07:16 +0000 (16:07 -0400)] 
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.

9 months agopkg-config: add Requires.private: libcap
Luca Boccassi [Wed, 22 Jan 2025 21:16:05 +0000 (21:16 +0000)] 
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

9 months agocore/device: do not drop backslashes in SYSTEMD_WANTS=/SYSTEMD_USER_WANTS= (#35869)
Yu Watanabe [Thu, 23 Jan 2025 00:04:12 +0000 (09:04 +0900)] 
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 ceed8f0c8b9a46300eccd1afa2dd8d3c2cb6b47c (v233).

Fixes #16735.
Replaces #16737 and #35768.

9 months agomkosi: Update to latest (#36114)
Yu Watanabe [Thu, 23 Jan 2025 00:00:39 +0000 (09:00 +0900)] 
mkosi: Update to latest (#36114)

9 months agopretty-print: fix handling of line continuation in cat_file() (#35886)
Yu Watanabe [Wed, 22 Jan 2025 23:59:24 +0000 (08:59 +0900)] 
pretty-print: fix handling of line continuation in cat_file() (#35886)

Fixes #35878.

9 months agonetwork/ndisc: allow to configure route option preference (#35213)
Yu Watanabe [Wed, 22 Jan 2025 23:58:30 +0000 (08:58 +0900)] 
network/ndisc: allow to configure route option preference (#35213)

Continuation of #35212.
Closes #35714.

9 months agocore/job: never consider reload jobs redundant
Mike Yuan [Wed, 22 Jan 2025 18:36:27 +0000 (19:36 +0100)] 
core/job: never consider reload jobs redundant

Follow-up for 656bbffc6c45bdd8d5c28a96ca948ba16c546547

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.

9 months agomkosi: switch rootfs to ext4
Luca Boccassi [Wed, 22 Jan 2025 19:11:55 +0000 (19:11 +0000)] 
mkosi: switch rootfs to ext4

btrfs is currently broken for nspawn on recent kernels, so switch
to the best filesystem until that is solved

9 months agomkosi: Update to latest 36114/head
Daan De Meyer [Wed, 22 Jan 2025 14:58:13 +0000 (15:58 +0100)] 
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.

9 months agomkosi: Run two more mkosi commands with sudo
Daan De Meyer [Wed, 22 Jan 2025 21:24:36 +0000 (22:24 +0100)] 
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.

9 months agoudev-dump: also show written sysfs attributes and sysctl entries (#36091)
Luca Boccassi [Wed, 22 Jan 2025 20:56:31 +0000 (20:56 +0000)] 
udev-dump: also show written sysfs attributes and sysctl entries (#36091)

Split-out of #35968.

9 months agoOBS: switch to new top-level namespace (#36121)
Luca Boccassi [Wed, 22 Jan 2025 20:50:44 +0000 (20:50 +0000)] 
OBS: switch to new top-level namespace (#36121)

https://build.opensuse.org/project/show/system:systemd

9 months agodocs: mention packages in HACKING.md 36121/head
Luca Boccassi [Wed, 22 Jan 2025 20:37:23 +0000 (20:37 +0000)] 
docs: mention packages in HACKING.md

9 months agotest-network: add test case for [IPv6RoutePrefix] Preference= 35213/head
Yu Watanabe [Mon, 18 Nov 2024 05:57:27 +0000 (14:57 +0900)] 
test-network: add test case for [IPv6RoutePrefix] Preference=

9 months agonetwork/radv: add [IPv6RoutePrefix] Preference= setting
Yu Watanabe [Mon, 18 Nov 2024 05:48:35 +0000 (14:48 +0900)] 
network/radv: add [IPv6RoutePrefix] Preference= setting

9 months agonetwork/radv: modernize config_parse_router_preference()
Yu Watanabe [Mon, 18 Nov 2024 05:45:03 +0000 (14:45 +0900)] 
network/radv: modernize config_parse_router_preference()

9 months agoudevadm-test: allow to specify extra directories to load udev rules files
Yu Watanabe [Sat, 11 Jan 2025 08:54:43 +0000 (17:54 +0900)] 
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.

9 months agorpm: mark udevd for reloading when an rules file is installed/updated
Yu Watanabe [Tue, 7 Jan 2025 19:19:45 +0000 (04:19 +0900)] 
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.

9 months agoudev: add systemd tag to devices tagged with security-device
Nick Rosbrook [Wed, 22 Jan 2025 16:59:36 +0000 (11:59 -0500)] 
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.

9 months agoTEST-65-ANALYZE: add detailed test case for cat-config 35886/head
Yu Watanabe [Wed, 8 Jan 2025 18:35:02 +0000 (03:35 +0900)] 
TEST-65-ANALYZE: add detailed test case for cat-config

9 months agopretty-print: make cat_file() also highlight the trailing backslash for line continuation
Yu Watanabe [Mon, 6 Jan 2025 19:06:35 +0000 (04:06 +0900)] 
pretty-print: make cat_file() also highlight the trailing backslash for line continuation

9 months agopretty-print: fix handling of line continuation in cat_file()
Yu Watanabe [Mon, 6 Jan 2025 19:02:53 +0000 (04:02 +0900)] 
pretty-print: fix handling of line continuation in cat_file()

Fixes #35878.

9 months agopretty-print: cleanups for cat_file()
Yu Watanabe [Mon, 6 Jan 2025 18:59:55 +0000 (03:59 +0900)] 
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.

9 months agouserdb: add comments to userdb varlink IDL
Lennart Poettering [Tue, 21 Jan 2025 09:24:44 +0000 (10:24 +0100)] 
userdb: add comments to userdb varlink IDL

9 months agomachine-id-setup: actually unlink /run/machine-id if write/mount fails (#36105)
Lennart Poettering [Wed, 22 Jan 2025 20:41:57 +0000 (21:41 +0100)] 
machine-id-setup: actually unlink /run/machine-id if write/mount fails (#36105)

Follow-up for 64d52739c59e28a5eb453f749e24f23b2d2ec06a

Fixes CID#1590374 and CID#1590375

9 months agopidfd-util: preferably acquire pidfd inode id through name_to_handle_at()
Mike Yuan [Wed, 22 Jan 2025 02:00:32 +0000 (03:00 +0100)] 
pidfd-util: preferably acquire pidfd inode id through name_to_handle_at()

See rationales described in kernel commit:
https://github.com/torvalds/linux/commit/b3caba8f7a34a2bbaf45ffc6ff3a49b70afeb192

9 months agouserdb: two small fixes (#36115)
Lennart Poettering [Wed, 22 Jan 2025 20:41:28 +0000 (21:41 +0100)] 
userdb: two small fixes (#36115)

9 months agofs-util: at_flags_normalize_nofollow() follow-up (#36116)
Lennart Poettering [Wed, 22 Jan 2025 20:41:14 +0000 (21:41 +0100)] 
fs-util: at_flags_normalize_nofollow() follow-up (#36116)

Just some extension to 6981203f3a824ac3ceeb5a23c66942d5a284d9bb

9 months agotest: add test cases for parsing SYSTEMD_WANTS=/SYSTEMD_USER_WANTS= 35869/head
Yu Watanabe [Mon, 6 Jan 2025 10:16:23 +0000 (19:16 +0900)] 
test: add test cases for parsing SYSTEMD_WANTS=/SYSTEMD_USER_WANTS=

9 months agocore/device: do not drop backslashes in SYSTEMD_WANTS=/SYSTEMD_USER_WANTS=
Yu Watanabe [Mon, 6 Jan 2025 08:26:52 +0000 (17:26 +0900)] 
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 ceed8f0c8b9a46300eccd1afa2dd8d3c2cb6b47c (v233).

Fixes #16735.
Replaces #16737 and #35768.

9 months agoOBS: switch to new top-level namespace
Luca Boccassi [Wed, 22 Jan 2025 20:34:04 +0000 (20:34 +0000)] 
OBS: switch to new top-level namespace

https://build.opensuse.org/project/show/system:systemd

9 months agoudev-dump: also show written sysfs attributes and sysctl entries 36091/head
Yu Watanabe [Sat, 11 Jan 2025 07:38:02 +0000 (16:38 +0900)] 
udev-dump: also show written sysfs attributes and sysctl entries

This should be useful to know what is changed by processing an event.

9 months agoudev-dump: voidify one function call
Yu Watanabe [Wed, 22 Jan 2025 16:48:04 +0000 (01:48 +0900)] 
udev-dump: voidify one function call

Fixes CID#1590377.

9 months agofs-util: also add an at_flags_normalize_follow() helper 36116/head
Lennart Poettering [Wed, 22 Jan 2025 10:54:34 +0000 (11:54 +0100)] 
fs-util: also add an at_flags_normalize_follow() helper

This is the reverse of at_flags_normalize_follow()

9 months agoxattr-util: use at_flags_normalize_nofollow() at one more place
Lennart Poettering [Wed, 22 Jan 2025 10:54:50 +0000 (11:54 +0100)] 
xattr-util: use at_flags_normalize_nofollow() at one more place

9 months agouserdb: reset errno before getpwent() 36115/head
Lennart Poettering [Wed, 22 Jan 2025 15:44:12 +0000 (16:44 +0100)] 
userdb: reset errno before getpwent()

errno handling for NSS is always a bit weird since NSS modules generally
are not particularly careful with it. Hence let's initialize errno
explicitly before we invoke getpwent() so that we know it's in a
reasonable state afterwards on failure, or zero if not.

We do this in most places we use NSS, including in userdb when it comes
to getgrent(), just for getpwent() we don't so far. Address that.

9 months agouserdbctl: don't expect argument to --fuzzy
Lennart Poettering [Wed, 22 Jan 2025 10:55:24 +0000 (11:55 +0100)] 
userdbctl: don't expect argument to --fuzzy

The getopt() parser was completely wrong, it expected an argument where
wasn't expected or processes.

The test cases only passed by accident because they use the "user" verb
which is also the default verb. It would be accidently read as argument
for --fuzzy and ignored.

Fix that.

9 months agotest: Make sure we run lcov from the meson source directory
Daan De Meyer [Wed, 22 Jan 2025 13:55:45 +0000 (14:55 +0100)] 
test: Make sure we run lcov from the meson source directory

In ac75c5192797082c1965ab30be4711490f2937bc, we accidentally changed
the working directory that the tools executed in the wrapper script
are invoked in. This broke our invocations of lcov. Let's explicitly
run those in the meson source directory again to fix the coverage
workflow.

9 months agopo: Translated using Weblate (French)
Léane GRASSER [Wed, 22 Jan 2025 13:29:51 +0000 (14:29 +0100)] 
po: Translated using Weblate (French)

Currently translated at 100.0% (257 of 257 strings)

Co-authored-by: Léane GRASSER <leane.grasser@proton.me>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/fr/
Translation: systemd/main

9 months agomachine-id-setup: fix typo 36105/head
Mike Yuan [Wed, 22 Jan 2025 13:47:57 +0000 (14:47 +0100)] 
machine-id-setup: fix typo

9 months agomachine-id-setup: actually unlink /run/machine-id if write/mount fails
Mike Yuan [Wed, 22 Jan 2025 01:16:15 +0000 (02:16 +0100)] 
machine-id-setup: actually unlink /run/machine-id if write/mount fails

Follow-up for 64d52739c59e28a5eb453f749e24f23b2d2ec06a

Fixes CID#1590374 and CID#1590375

9 months agonetworkd-test: unconditionally stop previous invocation of networkd before starting...
Yu Watanabe [Tue, 21 Jan 2025 18:45:11 +0000 (03:45 +0900)] 
networkd-test: unconditionally stop previous invocation of networkd before starting new one

When networkd is already running, creating some .network files and
friends and starting networkd does not take any effect. Let's always
restart networkd when we want to start a new invocation.

9 months agomountpoint-util: several tweaks for fd_is_mount_point(), drop support for kernels...
Lennart Poettering [Wed, 22 Jan 2025 08:37:25 +0000 (09:37 +0100)] 
mountpoint-util: several tweaks for fd_is_mount_point(), drop support for kernels without /proc/pid/fdinfo/ (#36093)

9 months agomountpoint-util: port path_is_mount_point() to chase_and_open_parent() 36093/head
Mike Yuan [Mon, 20 Jan 2025 22:02:00 +0000 (23:02 +0100)] 
mountpoint-util: port path_is_mount_point() to chase_and_open_parent()

9 months agomountpoint-util: rename fd_is_mount_point() to is_mount_point_at()
Mike Yuan [Mon, 20 Jan 2025 20:53:43 +0000 (21:53 +0100)] 
mountpoint-util: rename fd_is_mount_point() to is_mount_point_at()

fd_* functions in our codebase usually mean fd-specific operations,
while this one actually takes openat()-style params. Rename it
accordingly hence.