tmpfiles: skip an entry that takes its argument from a credential

A ^ after the type says the argument is the name of a credential to
read the real argument from.  Files from systemd have them:

    f^ /etc/hosts - - - - network.hosts

The ^ was not read, so on a system without /etc/hosts this made one
holding the text "network.hosts".

Finit has no credentials.  Skip the entry, which is what systemd does
when the credential is not set.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-20 19:10:04 +01:00
1 parent ddb4f18fa9
commit 81ce7a2833
4 files changed
+18 -3

No files matched your search

+4
View File
@@ -21,6 +21,7 @@ d $DIR - - - - -
L $DIR/aligned - - - - /dev/null
f $DIR/dash - - - - -
f $DIR/text - - - - two words
f^ $DIR/cred - - - - some.credential
CONF
run "/libexec/finit/tmpfiles --create $CONF"
@@ -31,6 +32,9 @@ assert "File content" "$(texec cat $DIR/text)" = "two words"
say 'A lone - is no argument'
assert "Empty file" "$(texec stat -c %s $DIR/dash)" = "0"
say 'An entry that takes its argument from a credential is skipped'
assert "No file" "$(texec sh -c "ls $DIR | grep -c cred")" = "0"
sep
say 'L? only makes the link when what it points to is there'
run "cat > $CONF" <<CONF