]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tmpfiles: Test C-style escape sequences
authorWill Fancher <elvishjerricco@gmail.com>
Fri, 26 May 2023 04:02:35 +0000 (00:02 -0400)
committerWill Fancher <elvishjerricco@gmail.com>
Fri, 26 May 2023 04:45:15 +0000 (00:45 -0400)
test/units/testsuite-22.17.sh [new file with mode: 0755]

diff --git a/test/units/testsuite-22.17.sh b/test/units/testsuite-22.17.sh
new file mode 100755 (executable)
index 0000000..d6b5360
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+#
+# Test for C-style escapes in file names and contents
+set -eux
+set -o pipefail
+
+data="\x20foo\nbar"
+dst="/tmp/x/\x20a\nb"
+
+systemd-tmpfiles --create - <<EOF
+f     "$dst" 0644 0 0 - $data
+EOF
+
+diff /tmp/x/x20anb <(printf "\x20foo\nbar")