naccyde / rpms / systemd

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