tmpfiles: clean what an x entry keeps by the age of the entry

An x or X entry can have an age of its own in tmpfiles.d(5).  What it
keeps from the cleaning of the directory above is then cleaned by that
age instead:

    d /tmp       1777 root root 10d
    x /tmp/build -    -    -    30d

tmpfiles does not read the age, so /tmp/build is never cleaned.

Clean the paths of such an entry by its age, with the entry itself
left out of what is kept.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-21 17:14:03 +01:00
1 parent 9ea64e5c3c
commit 9160ca3ddf
4 files changed
+33 -8

No files matched your search

+13
View File
@@ -102,3 +102,16 @@ CONF
run "chmod 600 $DIR/by-all/file $DIR/by-m/file; /libexec/finit/tmpfiles --clean $CONF"
assert_left $DIR/by-all "file "
assert_left $DIR/by-m ""
sep
say 'An x entry with an age of its own has what it keeps cleaned by that age'
run "mkdir -p $DIR/own/keep $DIR/own/long; touch $DIR/own/file $DIR/own/keep/file $DIR/own/long/file"
sleep 2
clean <<CONF
d $DIR/own - - - 1s
x $DIR/own/keep - - - 1h
x $DIR/own/lon* - - - 1s
CONF
assert_left $DIR/own "keep long "
assert_left $DIR/own/keep "file "
assert_left $DIR/own/long ""