tmpfiles: set mode and owner for the entries that ignored them

Several types read the mode and owner of an entry and did nothing
with them.  An f entry was skipped when the file was there:

    f /var/log/app.log 0640 app adm

This left a file with another mode or owner as it was.  The owner of
p, b, and c entries was never set, and their mode was cut by the
umask.  C, z, and Z entries had neither applied.

Set them for all of these, Z for everything below the path.  Fifos
and device nodes are opened with O_PATH, so nothing is opened for
real.  A path that is not what the entry makes, like a directory
where a p entry wants a fifo, is left alone.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-20 18:03:30 +01:00
1 parent ec67ecc805
commit adf7080fca
4 files changed
+107 -37

No files matched your search

+3
View File
@@ -269,6 +269,9 @@ All relevant changes are documented in this file.
- Fix tmpfiles entries with an unknown user: `d` skipped the entry, but `f`
created the file owned by root and `e` set the group anyway. All of them
now skip the entry. An unknown group still only leaves the group as it is
- Fix mode and owner of tmpfiles entries that ignored them: an `f` entry for
a file that exists, the owner of `p`, `b`, and `c` entries, and both for
`C`, `z`, and `Z` entries
- Fix age `0` in a tmpfiles entry, it was read as no age. As in
tmpfiles.d(5), `tmpfiles --clean` now empties the directory of such an
entry