tmpfiles: skip a C entry with a relative path to copy from

The argument of a C entry was used as it is, so a relative one was
copied from the directory tmpfiles happened to be started in.  With
--root that directory is outside the new root, and

    C /etc/copy - - - - ../../../etc/shadow

in a file below the root copied a file of the running system into it.

systemd skips a C line when the path to copy from is not absolute.
Do the same, with a warning.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-21 19:23:51 +01:00
1 parent 225b2594b7
commit a629c8add3
3 files changed
+9

No files matched your search

+3
View File
@@ -375,6 +375,9 @@ All relevant changes are documented in this file.
- Fix tmpfiles entries with a relative path, they were run on whatever
directory `tmpfiles` was started in. As in tmpfiles.d(5), such an
entry is now skipped with a warning
- Fix tmpfiles `C` entries with a relative path to copy from, it was
taken from whatever directory `tmpfiles` was started in. As in
tmpfiles.d(5), such an entry is now skipped with a warning
- Fix logins refused after boot on a system with systemd's tmpfiles.d
files installed. They create `/run/nologin` at boot, and on systemd it
is removed by systemd-user-sessions. Finit now removes it when leaving