Merge pull request #11345 from kirbyfan64/tmpfiles-c-empty

tmpfiles: Make C still copy if the destination directory is empty
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2019-01-15 16:54:19 +01:00
committed by GitHub
7 changed files with 77 additions and 23 deletions
+29 -2
View File
@@ -6,8 +6,8 @@
set -e
set -x
rm -fr /tmp/{d,D,e}
mkdir /tmp/{d,D,e}
rm -fr /tmp/{C,d,D,e}
mkdir /tmp/{C,d,D,e}
#
# 'd'
@@ -93,3 +93,30 @@ test $(stat -c %U:%G:%a /tmp/e/3/d2) = "daemon:daemon:755"
test -f /tmp/e/3/f1
test $(stat -c %U:%G:%a /tmp/e/3/f1) = "root:root:644"
#
# 'C'
#
mkdir /tmp/C/{1,2,3}-origin
touch /tmp/C/{1,2,3}-origin/f1
chmod 755 /tmp/C/{1,2,3}-origin/f1
mkdir /tmp/C/{2,3}
touch /tmp/C/3/f1
systemd-tmpfiles --create - <<EOF
C /tmp/C/1 0755 daemon daemon - /tmp/C/1-origin
C /tmp/C/2 0755 daemon daemon - /tmp/C/2-origin
EOF
test -d /tmp/C/1
test $(stat -c %U:%G:%a /tmp/C/1/f1) = "daemon:daemon:755"
test -d /tmp/C/2
test $(stat -c %U:%G:%a /tmp/C/2/f1) = "daemon:daemon:755"
! systemd-tmpfiles --create - <<EOF
C /tmp/C/3 0755 daemon daemon - /tmp/C/3-origin
EOF
test $(stat -c %U:%G:%a /tmp/C/3/f1) = "root:root:644"