tmpfiles: read the files by name, the first entry for a path counts

The files were read one directory at a time, Finit's own first and
/etc/tmpfiles.d last, and every entry for a path was run.  With two
entries for a path the last one read won, so an entry in /etc won over
one in /usr/lib whatever the files were called.

tmpfiles.d(5) reads the files in the order of their names, whatever
directory they are in, and goes by the first entry that makes a path.
A package relies on that when it names its file to sort before or
after another.  Do the same.  As before, a file in a later directory
is read in place of one of the same name in an earlier one.

A later entry is skipped when it makes a path an earlier one makes, or
when both take a glob and remove, write to, or keep the path.  Several
w+ entries may add to one file.  The skip is only told about with
--dry-run or --debug, since Finit's files and those of other packages
overlap on most systems.

Finit's own files had two entries for some paths, and relied on the
last one.  Drop the ones that lost: /run/lock, /run/lock/subsys, and
/var/lock in legacy.conf, and /var/run and a second /var/spool in
var.conf.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-21 19:23:49 +01:00
1 parent 86bb79d7a1
commit dd186287d7
9 files changed
+152 -50

No files matched your search

+7
View File
@@ -52,6 +52,13 @@ All relevant changes are documented in this file.
tmpfiles.d(5), a path is created after the paths above it, and removed
after those below it, wherever in the files the entries are. Entries
that take a glob, like `w` and `z`, are run after the others
- tmpfiles: the files are now read in the order of their names, whatever
directory they are in, and the first entry that makes a path is the one
that counts, as in tmpfiles.d(5). Before, they were read one directory
at a time and every entry for a path was run, so the last one won. To
change an entry from a file in `/usr/lib/tmpfiles.d`, use a file of the
same name in `/etc/tmpfiles.d`, or one with a name that sorts before it.
`tmpfiles --dry-run` tells which entries are skipped
- 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`