tmpfiles: keep what x and X entries name from being cleaned

The x and X entries were read and ignored, so a path that a package
had marked to be left alone was cleaned like the rest:

    d /var/tmp      - - - 30d
    x /var/tmp/keep

    tmpfiles --clean t.conf

This removed what was old in /var/tmp/keep.

Gather the x and X entries of all files in a pass before the cleaning,
they may come after the entry they apply to, or in another file.  x
keeps the path and what is in it, X the path alone.  A directory that
is not empty afterwards is no longer warned about.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-20 18:02:36 +01:00
1 parent 9392f2082e
commit 60cd11ab23
3 files changed
+77 -7

No files matched your search

+13
View File
@@ -40,3 +40,16 @@ CONF
assert_left $DIR/young "file "
assert_left $DIR/old "mnt "
assert_left $DIR/old/mnt "file "
sep
say 'x keeps a path and what is in it, X only the path itself'
run "mkdir -p $DIR/keep/all $DIR/keep/dir; touch $DIR/keep/file $DIR/keep/all/file $DIR/keep/dir/file"
sleep 2
clean <<CONF
d $DIR/keep - - - 1s
x $DIR/keep/a*
X $DIR/keep/dir/
CONF
assert_left $DIR/keep "all dir "
assert_left $DIR/keep/all "file "
assert_left $DIR/keep/dir ""