mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: skip the space before the argument of an entry
An entry written in aligned columns got the space after the age field
as part of its argument:
L /tmp/null - - - - /dev/null
This made a link to " /dev/null". Only the first separator after
the age was dropped. A lone "-" for no argument was also taken as is,
so an f entry with it made a file holding a dash.
Skip all the space before the argument, and read "-" as no argument.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
4 files changed
+42
No files matched your search
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
# Verify how tmpfiles reads the argument, the last field of an entry
|
||||
set -eu
|
||||
|
||||
TEST_DIR=$(dirname "$0")
|
||||
|
||||
DIR=/tmp/arg
|
||||
CONF=/tmp/arg.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 - - - - -
|
||||
L $DIR/aligned - - - - /dev/null
|
||||
f $DIR/dash - - - - -
|
||||
f $DIR/text - - - - two words
|
||||
CONF
|
||||
run "/libexec/finit/tmpfiles --create $CONF"
|
||||
|
||||
say 'Space between the age and the argument is not part of the argument'
|
||||
assert "Link target" "$(texec readlink $DIR/aligned)" = "/dev/null"
|
||||
assert "File content" "$(texec cat $DIR/text)" = "two words"
|
||||
|
||||
say 'A lone - is no argument'
|
||||
assert "Empty file" "$(texec stat -c %s $DIR/dash)" = "0"
|
||||
Reference in new issue
Block a user