diff options
author | Franck Bui <fbui@suse.com> | 2022-04-08 08:32:04 +0200 |
---|---|---|
committer | Franck Bui <fbui@suse.com> | 2022-04-11 11:22:39 +0200 |
commit | 9f55d48ba50afaad4557710f983d2971e9746582 (patch) | |
tree | c5d731b6ca4aee0da86630990ab8395395c67cda /test | |
parent | tmpfiles.d: only 'w+' can have multiple lines for the same path (diff) | |
download | systemd-9f55d48ba50afaad4557710f983d2971e9746582.tar.xz systemd-9f55d48ba50afaad4557710f983d2971e9746582.zip |
test tmpfiles: add a test for 'w+'
Diffstat (limited to 'test')
-rwxr-xr-x | test/units/testsuite-22.03.sh | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/units/testsuite-22.03.sh b/test/units/testsuite-22.03.sh index 404e33e2fa..a9df3d6bdd 100755 --- a/test/units/testsuite-22.03.sh +++ b/test/units/testsuite-22.03.sh @@ -186,6 +186,7 @@ test ! -e /tmp/F/daemon/unsafe-symlink/exploit # 'w' # touch /tmp/w/overwritten +touch /tmp/w/appended ### nop if the target does not exist. systemd-tmpfiles --create - <<EOF @@ -205,13 +206,22 @@ EOF test -f /tmp/w/overwritten test "$(< /tmp/w/overwritten)" = "old content" -### new content is overwritten +### old content is overwritten systemd-tmpfiles --create - <<EOF w /tmp/w/overwritten 0644 - - - new content EOF test -f /tmp/w/overwritten test "$(< /tmp/w/overwritten)" = "new content" +### append lines +systemd-tmpfiles --create - <<EOF +w+ /tmp/w/appended 0644 - - - 1 +w+ /tmp/w/appended 0644 - - - 2\n +w+ /tmp/w/appended 0644 - - - 3 +EOF +test -f /tmp/w/appended +test "$(< /tmp/w/appended)" = "$(echo -ne '12\n3')" + ### writing into an 'exotic' file should be allowed. systemd-tmpfiles --create - <<EOF w /dev/null - - - - new content |