dryang / rpms / systemd

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