tmpfiles: only take a # at the start of a line as a comment

An entry with a # in the argument loses it and the rest of the line:

    f /tmp/file - - - - a#b c

gives a file holding "a".  The lines are read with fparseln(), which
by default takes a # anywhere in a line as the start of a comment.  In
tmpfiles.d(5) only a line that starts with # is a comment.

Read the lines without a comment character and skip the lines that
start with one.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-21 17:13:53 +01:00
1 parent 7ec4376eb0
commit 309844fc11
3 files changed
+13 -3

No files matched your search

+4
View File
@@ -317,6 +317,10 @@ All relevant changes are documented in this file.
entry
- Fix `\x` escapes with the digits 8 or 9 in the argument of a tmpfiles
entry, `\x39` was written as the byte 3 and a `9`
- Fix a `#` in the argument of a tmpfiles entry, it and the rest of the
line were dropped as a comment. As in tmpfiles.d(5), only a line that
starts with `#` is a comment. **Note:** a comment at the end of an
entry is now read as its argument
- 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