tmpfiles: clean what an e entry with a glob matches

An e entry takes a glob, but cleaning looked for a directory with
the pattern as its name:

    e /var/cache/* - - - 10d

    tmpfiles --clean t.conf

This cleaned nothing.

Expand the glob and clean each directory it matches.  Also use the
age of a C entry, tmpfiles.d(5) has it clean what it copied.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-20 18:03:34 +01:00
1 parent 9d49eaf4c7
commit bccd04d81d
3 files changed
+16 -6

No files matched your search

+6 -3
View File
@@ -66,19 +66,22 @@ assert_left $DIR/zero ""
assert_left $DIR/none "file "
sep
say 'Ages with several units, and ms'
run "mkdir -p $DIR/units $DIR/msec $DIR/long $DIR/level/sub $DIR/by-all $DIR/by-m"
run "touch $DIR/units/file $DIR/msec/file $DIR/long/file"
say 'Ages with several units, ms, and what a path matched by e holds'
run "mkdir -p $DIR/units $DIR/msec $DIR/long $DIR/glob-1 $DIR/glob-2 $DIR/level/sub $DIR/by-all $DIR/by-m"
run "touch $DIR/units/file $DIR/msec/file $DIR/long/file $DIR/glob-1/file $DIR/glob-2/file"
run "touch $DIR/level/file $DIR/level/sub/file $DIR/by-all/file $DIR/by-m/file"
sleep 2
clean <<CONF
d $DIR/units - - - 0m1s
d $DIR/msec - - - 1500ms
d $DIR/long - - - 1h1s
e $DIR/glob-* - - - 1s
CONF
assert_left $DIR/units ""
assert_left $DIR/msec ""
assert_left $DIR/long "file "
assert_left $DIR/glob-1 ""
assert_left $DIR/glob-2 ""
sep
say 'With ~ what is right in the directory is kept'