1#!/usr/bin/env bash
2# SPDX-License-Identifier: LGPL-2.1-or-later
3set -eux
4set -o pipefail
5
6systemd-tmpfiles --create - <<EOF
7f /tmp/xxx1 0644 - - - foo
8f /tmp/xxx2 0644 - - - foo bar
9f /tmp/xxx3 0644 - - - foo\x20bar
10f /tmp/xxx4 0644 - - - \x20foobar
11f /tmp/xxx5 0644 - - - foobar\x20
12f /tmp/xxx6 0644 - - -  foo bar
13f /tmp/xxx7 0644 - - -  foo bar \n
14f /tmp/xxx8 0644 - - - " foo bar "
15f /tmp/xxx9 0644 - - - ' foo bar '
16EOF
17
18echo -n "foo" | cmp /tmp/xxx1 -
19echo -n "foo bar" | cmp /tmp/xxx2 -
20echo -n "foo bar" | cmp /tmp/xxx3 -
21echo -n " foobar" | cmp /tmp/xxx4 -
22echo -n "foobar " | cmp /tmp/xxx5 -
23echo -n "foo bar" | cmp /tmp/xxx6 -
24echo "foo bar " | cmp /tmp/xxx7 -
25echo -n "\" foo bar \"" | cmp /tmp/xxx8 -
26echo -n "' foo bar '" | cmp /tmp/xxx9 -
27
28rm /tmp/xxx{1,2,3,4,5,6,7,8,9}
29