From e9c79ce4d976fd54b6ee961ce0a94b2204a702fe Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Jul 25 2024 10:23:52 +0000 Subject: Merge remote-tracking branch 'fedora/rawhide' into c10s-sig-hyperscale --- diff --git a/0001-tmpfiles-make-purge-hard-to-mis-use.patch b/0001-tmpfiles-make-purge-hard-to-mis-use.patch index 87b5fa5..033b575 100644 --- a/0001-tmpfiles-make-purge-hard-to-mis-use.patch +++ b/0001-tmpfiles-make-purge-hard-to-mis-use.patch @@ -1,18 +1,19 @@ -From f62d1f6ea55fc0dcccbe60582804c9b033f8ad0e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Tue, 18 Jun 2024 20:32:10 +0200 +From 1e788a7fb535a37a8268aa7dc5130f670eb72a6b Mon Sep 17 00:00:00 2001 +From: Daan De Meyer +Date: Tue, 23 Jul 2024 13:14:05 +0200 Subject: [PATCH] tmpfiles: make --purge hard to (mis-)use Follow-up for https://github.com/systemd/systemd/pull/33383. --- - src/tmpfiles/tmpfiles.c | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) + src/tmpfiles/tmpfiles.c | 17 +++++++++++++++++ + test/units/TEST-22-TMPFILES.18.sh | 4 ++-- + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c -index 5841db293e..9b0f744ba9 100644 +index 8cc8c1ccd6..14048545db 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c -@@ -4195,6 +4195,7 @@ static int parse_argv(int argc, char *argv[]) { +@@ -4197,6 +4197,7 @@ static int parse_argv(int argc, char *argv[]) { ARG_IMAGE_POLICY, ARG_REPLACE, ARG_DRY_RUN, @@ -20,7 +21,7 @@ index 5841db293e..9b0f744ba9 100644 ARG_NO_PAGER, }; -@@ -4218,10 +4219,18 @@ static int parse_argv(int argc, char *argv[]) { +@@ -4220,10 +4221,18 @@ static int parse_argv(int argc, char *argv[]) { { "replace", required_argument, NULL, ARG_REPLACE }, { "dry-run", no_argument, NULL, ARG_DRY_RUN }, { "no-pager", no_argument, NULL, ARG_NO_PAGER }, @@ -39,7 +40,7 @@ index 5841db293e..9b0f744ba9 100644 assert(argc >= 0); assert(argv); -@@ -4328,6 +4337,10 @@ static int parse_argv(int argc, char *argv[]) { +@@ -4330,6 +4339,10 @@ static int parse_argv(int argc, char *argv[]) { arg_dry_run = true; break; @@ -50,7 +51,7 @@ index 5841db293e..9b0f744ba9 100644 case ARG_NO_PAGER: arg_pager_flags |= PAGER_DISABLE; break; -@@ -4347,6 +4360,10 @@ static int parse_argv(int argc, char *argv[]) { +@@ -4349,6 +4362,10 @@ static int parse_argv(int argc, char *argv[]) { return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Refusing --purge without specification of a configuration file."); @@ -61,3 +62,27 @@ index 5841db293e..9b0f744ba9 100644 if (arg_replace && arg_cat_flags != CAT_CONFIG_OFF) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Option --replace= is not supported with --cat-config/--tldr."); +diff --git a/test/units/TEST-22-TMPFILES.18.sh b/test/units/TEST-22-TMPFILES.18.sh +index 5d24197c81..de23bbb95f 100755 +--- a/test/units/TEST-22-TMPFILES.18.sh ++++ b/test/units/TEST-22-TMPFILES.18.sh +@@ -21,7 +21,7 @@ systemd-tmpfiles --purge --dry-run - <<<"$c" + test -f /tmp/somedir/somefile + grep -q baz /tmp/somedir/somefile + +-systemd-tmpfiles --purge - <<<"$c" ++systemd-tmpfiles --purge --destroy-data - <<<"$c" + test ! -f /tmp/somedir/somefile + test ! -d /tmp/somedir/ + +@@ -29,6 +29,6 @@ systemd-tmpfiles --create --purge --dry-run - <<<"$c" + test ! -f /tmp/somedir/somefile + test ! -d /tmp/somedir/ + +-systemd-tmpfiles --create --purge - <<<"$c" ++systemd-tmpfiles --create --destroy-data --purge - <<<"$c" + test -f /tmp/somedir/somefile + grep -q baz /tmp/somedir/somefile +-- +2.45.2 +