|
|
17aa40 |
From 4871d0807e4add56258633d3c3452b0ee5cc8f99 Mon Sep 17 00:00:00 2001
|
|
|
17aa40 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
|
17aa40 |
Date: Wed, 7 Apr 2021 22:35:19 +0200
|
|
|
17aa40 |
Subject: [PATCH] TEST-22-TMPFILES: add reproducer for bug with X
|
|
|
17aa40 |
|
|
|
17aa40 |
(cherry picked from commit 1672be86021b5ae8e80d095409a4fffcba7cbb75)
|
|
|
17aa40 |
|
|
|
17aa40 |
Related: #1944468
|
|
|
17aa40 |
---
|
|
|
17aa40 |
test/TEST-22-TMPFILES/test-11.sh | 141 +++++++++++++++++++++++++++++++
|
|
|
17aa40 |
1 file changed, 141 insertions(+)
|
|
|
17aa40 |
create mode 100755 test/TEST-22-TMPFILES/test-11.sh
|
|
|
17aa40 |
|
|
|
17aa40 |
diff --git a/test/TEST-22-TMPFILES/test-11.sh b/test/TEST-22-TMPFILES/test-11.sh
|
|
|
17aa40 |
new file mode 100755
|
|
|
17aa40 |
index 0000000000..21ef210cd1
|
|
|
17aa40 |
--- /dev/null
|
|
|
17aa40 |
+++ b/test/TEST-22-TMPFILES/test-11.sh
|
|
|
17aa40 |
@@ -0,0 +1,141 @@
|
|
|
17aa40 |
+#! /bin/bash
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+set -e
|
|
|
17aa40 |
+set -x
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+rm -fr /tmp/x
|
|
|
17aa40 |
+mkdir /tmp/x
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+#
|
|
|
17aa40 |
+# 'x'
|
|
|
17aa40 |
+#
|
|
|
17aa40 |
+mkdir -p /tmp/x/{1,2}
|
|
|
17aa40 |
+touch /tmp/x/1/{x1,x2} /tmp/x/2/{y1,y2} /tmp/x/{z1,z2}
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+systemd-tmpfiles --clean - <
|
|
|
17aa40 |
+d /tmp/x - - - 0
|
|
|
17aa40 |
+x /tmp/x/1
|
|
|
17aa40 |
+EOF
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+find /tmp/x | sort
|
|
|
17aa40 |
+test -d /tmp/x/1
|
|
|
17aa40 |
+test -f /tmp/x/1/x1
|
|
|
17aa40 |
+test -f /tmp/x/1/x2
|
|
|
17aa40 |
+test ! -d /tmp/x/2
|
|
|
17aa40 |
+test ! -f /tmp/x/2/x1
|
|
|
17aa40 |
+test ! -f /tmp/x/2/x2
|
|
|
17aa40 |
+test ! -f /tmp/x/z1
|
|
|
17aa40 |
+test ! -f /tmp/x/z2
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+#
|
|
|
17aa40 |
+# 'X'
|
|
|
17aa40 |
+#
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+mkdir -p /tmp/x/{1,2}
|
|
|
17aa40 |
+touch /tmp/x/1/{x1,x2} /tmp/x/2/{y1,y2} /tmp/x/{z1,z2}
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+systemd-tmpfiles --clean - <
|
|
|
17aa40 |
+d /tmp/x - - - 0
|
|
|
17aa40 |
+X /tmp/x/1
|
|
|
17aa40 |
+EOF
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+find /tmp/x | sort
|
|
|
17aa40 |
+test -d /tmp/x/1
|
|
|
17aa40 |
+test ! -f /tmp/x/1/x1
|
|
|
17aa40 |
+test ! -f /tmp/x/1/x2
|
|
|
17aa40 |
+test ! -d /tmp/x/2
|
|
|
17aa40 |
+test ! -f /tmp/x/2/x1
|
|
|
17aa40 |
+test ! -f /tmp/x/2/x2
|
|
|
17aa40 |
+test ! -f /tmp/x/z1
|
|
|
17aa40 |
+test ! -f /tmp/x/z2
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+#
|
|
|
17aa40 |
+# 'x' with glob
|
|
|
17aa40 |
+#
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+mkdir -p /tmp/x/{1,2}
|
|
|
17aa40 |
+touch /tmp/x/1/{x1,x2} /tmp/x/2/{y1,y2} /tmp/x/{z1,z2}
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+systemd-tmpfiles --clean - <
|
|
|
17aa40 |
+d /tmp/x - - - 0
|
|
|
17aa40 |
+x /tmp/x/[1345]
|
|
|
17aa40 |
+x /tmp/x/z*
|
|
|
17aa40 |
+EOF
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+find /tmp/x | sort
|
|
|
17aa40 |
+test -d /tmp/x/1
|
|
|
17aa40 |
+test -f /tmp/x/1/x1
|
|
|
17aa40 |
+test -f /tmp/x/1/x2
|
|
|
17aa40 |
+test ! -d /tmp/x/2
|
|
|
17aa40 |
+test ! -f /tmp/x/2/x1
|
|
|
17aa40 |
+test ! -f /tmp/x/2/x2
|
|
|
17aa40 |
+test -f /tmp/x/z1
|
|
|
17aa40 |
+test -f /tmp/x/z2
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+#
|
|
|
17aa40 |
+# 'X' with glob
|
|
|
17aa40 |
+#
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+mkdir -p /tmp/x/{1,2}
|
|
|
17aa40 |
+touch /tmp/x/1/{x1,x2} /tmp/x/2/{y1,y2} /tmp/x/{z1,z2}
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+systemd-tmpfiles --clean - <
|
|
|
17aa40 |
+d /tmp/x - - - 0
|
|
|
17aa40 |
+X /tmp/x/[1345]
|
|
|
17aa40 |
+X /tmp/x/?[12]
|
|
|
17aa40 |
+EOF
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+find /tmp/x | sort
|
|
|
17aa40 |
+test -d /tmp/x/1
|
|
|
17aa40 |
+test ! -f /tmp/x/1/x1
|
|
|
17aa40 |
+test ! -f /tmp/x/1/x2
|
|
|
17aa40 |
+test ! -d /tmp/x/2
|
|
|
17aa40 |
+test ! -f /tmp/x/2/x1
|
|
|
17aa40 |
+test ! -f /tmp/x/2/x2
|
|
|
17aa40 |
+test -f /tmp/x/z1
|
|
|
17aa40 |
+test -f /tmp/x/z2
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+#
|
|
|
17aa40 |
+# 'x' with 'r'
|
|
|
17aa40 |
+#
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+mkdir -p /tmp/x/{1,2}/a
|
|
|
17aa40 |
+touch /tmp/x/1/a/{x1,x2} /tmp/x/2/a/{y1,y2}
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+systemd-tmpfiles --clean - <
|
|
|
17aa40 |
+# x/X is not supposed to influence r
|
|
|
17aa40 |
+x /tmp/x/1/a
|
|
|
17aa40 |
+X /tmp/x/2/a
|
|
|
17aa40 |
+r /tmp/x/1
|
|
|
17aa40 |
+r /tmp/x/2
|
|
|
17aa40 |
+EOF
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+find /tmp/x | sort
|
|
|
17aa40 |
+test -d /tmp/x/1
|
|
|
17aa40 |
+test -d /tmp/x/1/a
|
|
|
17aa40 |
+test -f /tmp/x/1/a/x1
|
|
|
17aa40 |
+test -f /tmp/x/1/a/x2
|
|
|
17aa40 |
+test -f /tmp/x/2/a/y1
|
|
|
17aa40 |
+test -f /tmp/x/2/a/y2
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+#
|
|
|
17aa40 |
+# 'x' with 'R'
|
|
|
17aa40 |
+#
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+mkdir -p /tmp/x/{1,2}/a
|
|
|
17aa40 |
+touch /tmp/x/1/a/{x1,x2} /tmp/x/2/a/{y1,y2}
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+systemd-tmpfiles --remove - <
|
|
|
17aa40 |
+# X is not supposed to influence R
|
|
|
17aa40 |
+X /tmp/x/1/a
|
|
|
17aa40 |
+X /tmp/x/2/a
|
|
|
17aa40 |
+R /tmp/x/1
|
|
|
17aa40 |
+EOF
|
|
|
17aa40 |
+
|
|
|
17aa40 |
+find /tmp/x | sort
|
|
|
17aa40 |
+test ! -d /tmp/x/1
|
|
|
17aa40 |
+test ! -d /tmp/x/1/a
|
|
|
17aa40 |
+test ! -f /tmp/x/1/a/x1
|
|
|
17aa40 |
+test ! -f /tmp/x/1/a/x2
|
|
|
17aa40 |
+test -f /tmp/x/2/a/y1
|
|
|
17aa40 |
+test -f /tmp/x/2/a/y2
|