Commit Graph

623 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
ec596fe34e Merge pull request #30480 from keszybz/kernel-install-more-paths
Read kernel-install config from /run/kernel too
2024-03-08 08:25:07 +01:00
Zbigniew Jędrzejewski-Szmek
9bc7493098 strv: add helper to extend strv from both sides
Also, use the more correct type of 'const char* const*' for the input strv.
This requires adding the cast in a few places, but also allows to remove some
casts in others.
2024-03-07 18:49:44 +01:00
Mike Yuan
29a438e764 tmpfiles: do 'X' bit check in an ACL-aware manner
Follow-up for 26d98cdd78

I.e. stat() cannot be used here.

Also, before this commit, the 'X' is only applied if
the owner has execute bit set. Now it takes group and
other into consideration too. setfacl(1) also has
the same behavior.
2024-03-07 03:18:46 +08:00
Mike Yuan
83a5db202d tmpfiles: remove one more use of goto and modernization 2024-03-07 03:18:46 +08:00
Antonio Alvarez Feijoo
43aca0d99e extract-word: update remaining calls to extract_many_words
Follow-up to 4f49512695
2024-03-05 12:21:42 +00:00
Lennart Poettering
f4a63ce25f dissect-image: add flag for explicitly enabling userspace verity signature checking
let's make userspace verity signature checking optional. This adds a
dissection flag to enable the logic and patches through all our users to
enable it by default, thus effectively not changing anything from the
status quo ante. However, know we have a knob to turn this off in
certain scenarios.
2024-02-28 16:17:40 +01:00
Zbigniew Jędrzejewski-Szmek
8f43182847 various: use modern strv helpers
If we're building a strv, let's just use strv_new() with the CONF_PATHS macro,
which gives as an exploded string set.
2024-02-28 11:10:34 +01:00
Yu Watanabe
e40b11be04 fs-util: rename xopenat() -> xopanat_full() 2024-02-16 00:25:37 +09:00
Zbigniew Jędrzejewski-Szmek
983dbcefe8 systemd-tmpfiles: use statx_mount_same
It was pointed out in review that the preexisting code should be updated
(https://github.com/systemd/systemd/pull/30380#discussion_r1426899180).
2024-02-12 13:34:25 +01:00
Zbigniew Jędrzejewski-Szmek
9e90d4f42e tmpfiles: implement --dry-run
The idea is simple: skip the final operation that creates or removes things
or changes the attributes, but otherwise go through the rest of the code.
This results in quite a lot of fairly repetitive conditions in the low-level
code. Another approach would be to print earlier, at a higher level, but then
we'd have less precise information about what is about to happen.
2024-02-12 13:33:30 +01:00
Zbigniew Jędrzejewski-Szmek
117aa0140f tmpfiles: simplify how a helper function is called
No functional change.
2024-02-09 17:57:42 +01:00
Zbigniew Jędrzejewski-Szmek
b1935cc943 tmpfiles: use dir_cleanup() for R and D
... i.e. apply nested config (exclusions and such) when executing R and D.

This fixes a long-standing RFE. The existing logic seems to have been an
accident of implementation. After all, if somebody specifies a config with
'R /foo; x /tmp/bar', then probably the goal is to remove stuff from under /foo,
but keep /tmp/bar. If they just wanted to nuke everything, then would not specify
the second item.

This also makes R and D use O_NOATIME, i.e. the access times of the directories
that are accessed will not be changed by the cleanup.

Obviously, we'll have to add this to NEWS and such.
Looking at the whole tmpfiles.d config in Fedora, this change has no effect.

The test cases are adjusted as appropriate. I also added another test case for
'R'/'D' with a file, just to test this code path more.

Replaces #20641.
Fixes #1633.
2024-02-09 17:57:42 +01:00
Zbigniew Jędrzejewski-Szmek
7eeda1da90 tmpfiles: split out helper to open a directory
In preparation for future commits.
2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
db6873bfeb tmpfiles: drop unnecessary assignment 2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
9c8a0ca69e tmpfiles: split out verbs in help
One of the three must always be specified, but they buried in a long list of
options in the output of --help. Make them more visible to draw the eye.

Also, drop "marked" from the description. It's supposed to mean "configured",
but it's a strange way to say that, and also it's generally obvious that the
program does what its configuration tells it to, and it's not going to remove
all files found on the system.
2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
f7862b2a00 tree-wide: use normal spelling of "reopen"
It's a commonly used verb meaning "to open again".
2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
ad36bb9fbb tmpfiles: break long log invocations and comments 2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
e5876c29ad tmpfiles: inline variable declarations, use FOREACH_ARRAY and RET_GATHER 2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
f6a1346e4e tmpfiles: split out helper to open and read a "config file"
No functional change.

Note that this function will be modified in subsequent commits, and the API
will change.
2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
376d0495f5 tmpfiles: only populate uid and gid caches once
a3451c2c4c added offline uid/gid support in a way
where the <root>/etc/passwd and <root>/etc/group would be read anew for each
configuration file that was parsed. The result would always be the same, so I
assume that this was an oversight. Let's use a global cache and and read the
file just once.
2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
5ac41a1672 tmpfiles: adjust vertical whitespace 2024-02-09 17:57:41 +01:00
Zbigniew Jędrzejewski-Szmek
37ee46f7c8 sysusers,tmpfiles: clarify error message for --replace
I was trying to run sysusers --replace, but the input file didn't have the right
suffix, and the message was very confusing. Let's split the message in two to
make it clearer that we care about the extension.
2024-02-09 17:57:41 +01:00
r-vdp
25e6ce1c11 Fix bug where systemd-tmpfiles gets stuck on fifos in tmp.
Fixes #30690.
2024-01-29 12:16:38 +00:00
Lennart Poettering
69f3c61990 tree-wide: port over various pieces of code to strv_extend_many() 2024-01-17 11:32:11 +01:00
Mike Yuan
bdd2036e81 hexdecoct: make unbase64mem and unhexmem always use SIZE_MAX 2024-01-09 03:59:15 +09:00