tmpfiles: also order glob child/parent relationships
This is necessary so that "r" can be nested and are always executed in the same order. Fixes: #10191
This commit is contained in:
parent
09f467ac24
commit
bd0ce2447d
|
@ -3152,6 +3152,8 @@ static int link_parent(ItemArray *a) {
|
||||||
ItemArray *j;
|
ItemArray *j;
|
||||||
|
|
||||||
j = ordered_hashmap_get(items, prefix);
|
j = ordered_hashmap_get(items, prefix);
|
||||||
|
if (!j)
|
||||||
|
j = ordered_hashmap_get(globs, prefix);
|
||||||
if (j) {
|
if (j) {
|
||||||
r = set_ensure_allocated(&j->children, NULL);
|
r = set_ensure_allocated(&j->children, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
|
31
test/TEST-22-TMPFILES/test-07.sh
Executable file
31
test/TEST-22-TMPFILES/test-07.sh
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#! /bin/bash
|
||||||
|
#
|
||||||
|
# Verifies the issues described by https://github.com/systemd/systemd/issues/10191
|
||||||
|
#
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
rm -rf /tmp/test-prefix
|
||||||
|
|
||||||
|
mkdir /tmp/test-prefix
|
||||||
|
touch /tmp/test-prefix/file
|
||||||
|
|
||||||
|
systemd-tmpfiles --remove - <<EOF
|
||||||
|
r /tmp/test-prefix
|
||||||
|
r /tmp/test-prefix/file
|
||||||
|
EOF
|
||||||
|
|
||||||
|
! test -f /tmp/test-prefix/file
|
||||||
|
! test -f /tmp/test-prefix
|
||||||
|
|
||||||
|
mkdir /tmp/test-prefix
|
||||||
|
touch /tmp/test-prefix/file
|
||||||
|
|
||||||
|
systemd-tmpfiles --remove - <<EOF
|
||||||
|
r /tmp/test-prefix/file
|
||||||
|
r /tmp/test-prefix
|
||||||
|
EOF
|
||||||
|
|
||||||
|
! test -f /tmp/test-prefix/file
|
||||||
|
! test -f /tmp/test-prefix
|
Loading…
Reference in a new issue