From bd0ce2447d4e8be510e605699f866605274d6c71 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 20 Nov 2018 16:32:23 +0100 Subject: [PATCH] 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 --- src/tmpfiles/tmpfiles.c | 2 ++ test/TEST-22-TMPFILES/test-07.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100755 test/TEST-22-TMPFILES/test-07.sh diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index ea09abdb1c..acde15e2d8 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -3152,6 +3152,8 @@ static int link_parent(ItemArray *a) { ItemArray *j; j = ordered_hashmap_get(items, prefix); + if (!j) + j = ordered_hashmap_get(globs, prefix); if (j) { r = set_ensure_allocated(&j->children, NULL); if (r < 0) diff --git a/test/TEST-22-TMPFILES/test-07.sh b/test/TEST-22-TMPFILES/test-07.sh new file mode 100755 index 0000000000..39c04b925c --- /dev/null +++ b/test/TEST-22-TMPFILES/test-07.sh @@ -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 - <