tmpfiles: no warning for a d entry on a link to a directory

A d entry for a path that is a link to a directory warned that mode
and owner could not be set:

    d /var/lock 0755

Here /var/lock is a link to /run/lock.  The link is not followed, on
purpose, and the open fails.

That is not an error, leave the directory alone without a warning.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-20 19:10:03 +01:00
1 parent 7ee991daf2
commit a27c0d40f3
3 files changed
+11 -3

No files matched your search

+8
View File
@@ -120,3 +120,11 @@ sep
say 'A new file without a mode is 0644, whatever the umask'
run "echo 'f $DIR/default' > $CONF; umask 077; /libexec/finit/tmpfiles --create $CONF"
assert "Default mode" "$(texec stat -c '%a' $DIR/default)" = "644"
sep
say 'A link to a directory is left alone, without complaints'
run "mkdir $DIR/real; chmod 700 $DIR/real; ln -s real $DIR/link"
run "printf 'd $DIR/link 0755\ne $DIR/link 0755\n' > $CONF"
msg=$(texec sh -c "/libexec/finit/tmpfiles --create $CONF 2>&1")
assert "No warning" "$msg" = ""
assert "Directory as it was" "$(texec stat -c '%a' $DIR/real)" = "700"