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

+10 -3
View File
@@ -27,15 +27,22 @@ For your convenience a set of *optional* plugins are available:
runs `tmpfiles --create --remove --boot`, so entries marked boot-only
with a `!` are run here and at no other time.
By default, `/lib/finit/tmpfiles.d` carries all the default .conf
files distributed with Finit. It is read first but can be overridden
by any of the standard tmpfiles.d directories, e.g. `/etc/tmpfiles.d`.
The .conf files distributed with Finit are in `/lib/finit/tmpfiles.d`
and `/usr/lib/tmpfiles.d`. A file of the same name in `/run/tmpfiles.d`
or `/etc/tmpfiles.d` is read in its place. The files that remain are
read in the order of their names, whatever directory they are in, and
when two entries make the same path, the first one counts. So to
change an entry, copy its file to `/etc/tmpfiles.d` and edit it there,
or put the entry in a file with a name that sorts before it.
To see what the files on a system amount to, without anything being
done, add `--dry-run`:
/libexec/finit/tmpfiles --dry-run --create --remove --boot
It also tells which entries are skipped because a path already has
one.
The age of an entry, e.g. `10d` below, is used only by `tmpfiles
--clean`, which Finit never runs on its own: