tmpfiles: read quotes and escapes in the fields before the argument

There is no way to write an entry for a path with a space in it, the
fields are split at every space.  In tmpfiles.d(5) a field can be
quoted, and have C-style escapes:

    d "/srv/my files"
    d /srv/my\sfiles

Split the fields with a function that resolves both.  The argument is
still the rest of the line as it is, quotes and all, like in systemd.
An entry with a quote left open is skipped.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-21 17:14:01 +01:00
1 parent aa38c72044
commit ed96814fdc
4 files changed
+92 -13

No files matched your search

+2
View File
@@ -30,6 +30,8 @@ All relevant changes are documented in this file.
chattr(1), `H` also on everything below the path
- tmpfiles: add the `L?` entry, a link that is only made when what it
points to exists, the same as Finit's own `l` entry
- tmpfiles: the path of an entry can now be quoted and have backslash
escapes, for a path with a space in it: `d "/srv/my files"`
- tmpfiles: add `--prefix=PATH`, to only run the entries for paths below
it. `--prefix` and `--exclude-prefix` match whole path components,
`--exclude-prefix=/dev` no longer skips `/devices`