From: Daan De Meyer Date: Mon, 20 Feb 2023 15:39:34 +0000 (+0100) Subject: repart: Exclude APIVFS mountpoint directories X-Git-Tag: v254-rc1~1196^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F26500%2Fhead;p=thirdparty%2Fsystemd.git repart: Exclude APIVFS mountpoint directories Also exclude APIVFS and temporary files directories from the copy operation so that these files don't accidentally end up in images. --- diff --git a/src/partition/repart.c b/src/partition/repart.c index 786f7d8da56..4e0c5dd785c 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -4065,6 +4065,12 @@ static int make_copy_files_denylist(Context *context, const Partition *p, Hashma } } + FOREACH_STRING(s, "proc", "sys", "dev", "tmp", "run", "var/tmp") { + r = add_exclude_path(s, &denylist, DENY_CONTENTS); + if (r < 0) + return r; + } + STRV_FOREACH(e, p->exclude_files) { r = add_exclude_path(*e, &denylist, endswith(*e, "/") ? DENY_CONTENTS : DENY_INODE); if (r < 0) diff --git a/test/units/testsuite-58.sh b/test/units/testsuite-58.sh index 99f6223d402..c58465356c2 100755 --- a/test/units/testsuite-58.sh +++ b/test/units/testsuite-58.sh @@ -852,6 +852,8 @@ test_exclude_files() { runas testuser mkdir "$root/usr" runas testuser touch "$root/usr/def" runas testuser touch "$root/usr/qed" + runas testuser mkdir "$root/tmp" + runas testuser touch "$root/tmp/prs" runas testuser tee "$defs/00-root.conf" <