tmpfiles: add the % specifiers for path and argument

An entry with a % in the path was skipped, and files from
distributions have them:

    d /run/log/journal/%m 2755 root systemd-journal - -

Expand the specifiers that do not need the OS release or the
architecture: %b, %m, %H, %l, %v, the directories %t, %T, %V, %S, %C,
%L, %h, and the user ones %u, %U, %g, %G.  tmpfiles runs as root, so
the last ones are fixed.  An entry with any other specifier is still
skipped.

The argument of C, f, F, L, and w entries is expanded too, as in
tmpfiles.d(5).  A literal % in such an argument must from now on be
written %%.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-20 18:03:33 +01:00
1 parent 83f4dceb1b
commit b87d235cf7
9 files changed
+176 -15

No files matched your search

+7 -5
View File
@@ -24,11 +24,10 @@ user to call it from cron.
2. Specifiers
-------------
A path with `%` in it is skipped, also the escaped `%%`. The ones that
show up in files from distributions are `%b` (boot ID), `%m` (machine
ID), `%H` (hostname), `%v` (kernel release), and for the argument `%T`
and `%V`. This is the largest gap for using such files unchanged, and
the most work.
Missing are the ones for the OS release and the architecture: `%a`,
`%A`, `%B`, `%M`, `%o`, `%w`, and `%W`. An entry with one of them is
skipped. `%T` and `%V` are always `/tmp` and `/var/tmp`, they do not
look at `$TMPDIR`.
3. Remaining types and modifiers
@@ -64,4 +63,7 @@ their own paths.
* A `d` or `e` entry for a path that is a link to a directory warns
that mode and owner could not be set
* An age so large that it overflows is not caught
* A `w` entry with a glob that matches several paths writes its
argument only up to the first backslash for all but the first,
`write_arg()` cuts the argument up as it goes
* `mksubsys()` in `src/util.c` is unused