mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: skip an entry that is not supported, do not exit
tmpfiles exited at the first entry with a type it does not know, or
with a % specifier in the path:
h /tmp/dir - - - - +i
f /tmp/dir/after
tmpfiles --create t.conf
This never created /tmp/dir/after. At boot it meant that one such
line, in any tmpfiles.d file, stopped every entry after it, in that
file and in all the files sorted after it. The message says skipping,
but errx() exits.
Warn and go on with the next entry. With two passes, for --create
with --remove, only the second one warns.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
4 files changed
+52
-3
No files matched your search
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
# Verify that tmpfiles skips an entry it does not support, and goes on
|
||||
# with the rest
|
||||
set -eu
|
||||
|
||||
TEST_DIR=$(dirname "$0")
|
||||
|
||||
DIR=/tmp/unsupported
|
||||
CONF=/tmp/unsupported.conf
|
||||
|
||||
test_teardown()
|
||||
{
|
||||
say "Running test teardown."
|
||||
run "rm -rf $DIR $CONF"
|
||||
}
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
. "$TEST_DIR/lib/setup.sh"
|
||||
|
||||
run "cat > $CONF" <<CONF
|
||||
d $DIR
|
||||
h $DIR - - - - +i
|
||||
f $DIR/%m
|
||||
f $DIR/after
|
||||
CONF
|
||||
|
||||
say 'Create only'
|
||||
msg=$(texec sh -c "/libexec/finit/tmpfiles --create $CONF 2>&1")
|
||||
assert "The entry after is created" "$(texec ls $DIR)" = "after"
|
||||
assert "Each is reported once" "$(echo "$msg" | grep -c skipping)" -eq 2
|
||||
|
||||
say 'Remove and create, two passes'
|
||||
run "rm $DIR/after"
|
||||
msg=$(texec sh -c "/libexec/finit/tmpfiles --create --remove $CONF 2>&1")
|
||||
assert "The entry after is created" "$(texec ls $DIR)" = "after"
|
||||
assert "Each is reported once" "$(echo "$msg" | grep -c skipping)" -eq 2
|
||||
Reference in new issue
Block a user