mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: create a path after those above it, glob entries last
An entry was run as its line was read, so the outcome followed the
order of the lines and of the files. With
f /var/run/app/file
L /var/run - - - - ../run
the f entry made /var/run a directory, and the link was never made.
An entry like z or w, placed before the one that makes its path, found
nothing to change.
tmpfiles.d(5) has a path created after the paths above it and removed
after those below it, and runs the entries that take a glob after the
others. Do the same. Every entry is now read before the first one is
run, which also means a line is parsed once, not once per pass, and
the pass that only gathered the x and X entries is gone.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
3 files changed
+206
-118
No files matched your search
+15
-2
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Verify that tmpfiles removes before it creates when asked to do both
|
||||
# Verify the order tmpfiles runs the entries in
|
||||
set -eu
|
||||
|
||||
TEST_DIR=$(dirname "$0")
|
||||
@@ -34,5 +34,18 @@ r $DIR/file
|
||||
d $DIR/sub - - - 1d
|
||||
CONF
|
||||
out=$(texec /libexec/finit/tmpfiles --dry-run --create --remove --clean "$CONF")
|
||||
assert "What it would do" "$(echo "$out" | tr '\n' ';')" = "remove r $DIR/file;clean d $DIR/sub, older than 1d;create f $DIR/dry text;create d $DIR/sub;"
|
||||
assert "What it would do" "$(echo "$out" | tr '\n' ';')" = "clean d $DIR/sub, older than 1d;remove r $DIR/file;create f $DIR/dry text;create d $DIR/sub;"
|
||||
assert "Nothing is done" "$(texec ls $DIR)" = "file"
|
||||
|
||||
sep
|
||||
say 'A path is made after the one above it, wherever in the file they are'
|
||||
run "cat > $CONF" <<CONF
|
||||
w $DIR/real/file - - - - XY
|
||||
d $DIR/real
|
||||
f $DIR/link/file - - - - text
|
||||
L $DIR/link - - - - real
|
||||
CONF
|
||||
run "/libexec/finit/tmpfiles --create $CONF"
|
||||
assert "Link before the file below it" "$(texec readlink $DIR/link)" = "real"
|
||||
say 'An entry that takes a glob, like w, is run after the others'
|
||||
assert "File before it is written to" "$(texec cat $DIR/real/file)" = "XYxt"
|
||||
Reference in new issue
Block a user