mirror of
https://github.com/systemd/systemd.git
synced 2026-08-13 17:08:14 +00:00
tmpfiles: reject unused argument fields
Line types which do not use the argument field used to warn and ignore
a non-empty field. Treat that as invalid configuration instead, so typos
are not silently accepted.
Follow-up for: 614cc34f3a
This commit is contained in:
@@ -21,12 +21,19 @@ test ! -e /tmp/fifo
|
||||
test ! -e /tmp/test
|
||||
|
||||
# Test invalid config
|
||||
ret=0
|
||||
systemd-tmpfiles --inline --remove 'garbage' || ret=$?
|
||||
test "$ret" -eq 65 # EX_DATAERR
|
||||
|
||||
ret=0
|
||||
systemd-tmpfiles --inline --create 'd /tmp/test - - - - unexpected' || ret=$?
|
||||
test "$ret" -eq 65 # EX_DATAERR
|
||||
|
||||
echo 'garbage' >/tmp/config.conf
|
||||
ret=0
|
||||
systemd-tmpfiles --remove /tmp/config.conf || ret=$?
|
||||
test "$ret" -eq 65 # EX_DATAERR
|
||||
|
||||
ret=0
|
||||
systemd-tmpfiles --remove /tmp/config-missing.conf || ret=$?
|
||||
test "$ret" -eq 1
|
||||
|
||||
@@ -84,7 +84,7 @@ else
|
||||
fi
|
||||
|
||||
# Check for an invalid "age" and "age-by" arguments.
|
||||
for a in ':' ':1s' '2:1h' 'nope:42h' '" :7m"' 'm:' '::' '"+r^w-x:2/h"' 'b ar::64'; do
|
||||
for a in ':' ':1s' '2:1h' 'nope:42h' '" :7m"' 'm:' '::' '"+r^w-x:2/h"' '"b ar::64"'; do
|
||||
systemd-tmpfiles --clean - <<EOF 2>&1 | grep -F 'Invalid age' >/dev/null
|
||||
d /tmp/ageby - - - ${a} -
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user