Version in base suite: 3.18.0-2+deb11u1 Base version: logrotate_3.18.0-2+deb11u1 Target version: logrotate_3.18.0-2+deb11u2 Base file: /srv/ftp-master.debian.org/ftp/pool/main/l/logrotate/logrotate_3.18.0-2+deb11u1.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/l/logrotate/logrotate_3.18.0-2+deb11u2.dsc changelog | 9 + patches/applied-upstream/writeState-do-nothing-if-state-file-is-dev-null.patch | 76 ++++++++++ patches/series | 1 3 files changed, 85 insertions(+), 1 deletion(-) gpgv: Signature made Wed May 25 23:44:32 2022 UTC gpgv: using RSA key 9236557B170C87F8821C0AC3C1E0D92E986F7C7E gpgv: Can't check signature: No public key dpkg-source: warning: failed to verify signature on /srv/release.debian.org/tmp/tmpwf1gdb_a/logrotate_3.18.0-2+deb11u1.dsc diff -Nru logrotate-3.18.0/debian/changelog logrotate-3.18.0/debian/changelog --- logrotate-3.18.0/debian/changelog 2022-01-30 16:29:14.000000000 +0000 +++ logrotate-3.18.0/debian/changelog 2023-06-30 17:45:16.000000000 +0000 @@ -1,4 +1,11 @@ -logrotate (3.18.0-2+deb11u1) bullseye; urgency=medium +logrotate (3.18.0-2+deb11u2) bullseye; urgency=medium + + * d/patches: cherry-pick usptream fix: + - writeState: do nothing if state file is /dev/null (Closes: #1039868) + + -- Christian Göttsche Fri, 30 Jun 2023 19:45:16 +0200 + +logrotate (3.18.0-2+deb11u1) stable; urgency=medium * d/patches: cherry-pick upstream fixes: - skip locking if state file is world-readable (CVE-2022-1348) diff -Nru logrotate-3.18.0/debian/patches/applied-upstream/writeState-do-nothing-if-state-file-is-dev-null.patch logrotate-3.18.0/debian/patches/applied-upstream/writeState-do-nothing-if-state-file-is-dev-null.patch --- logrotate-3.18.0/debian/patches/applied-upstream/writeState-do-nothing-if-state-file-is-dev-null.patch 1970-01-01 00:00:00.000000000 +0000 +++ logrotate-3.18.0/debian/patches/applied-upstream/writeState-do-nothing-if-state-file-is-dev-null.patch 2023-06-30 17:45:16.000000000 +0000 @@ -0,0 +1,76 @@ +From: Kamil Dudka +Date: Thu, 3 Jun 2021 10:51:07 +0200 +Applied-Upstream: https://github.com/logrotate/logrotate/commit/456692644cbf5adb6253cb7ed2d169e950a9e348 +Subject: writeState: do nothing if state file is /dev/null + +If users do not want to use any state file, they can specify `/dev/null` +as the state file. Without this fix, logrotate would unnecessarily fail +to rename a temporary file to `/dev/null`. + +Fixes: https://github.com/logrotate/logrotate/issues/395 +--- + logrotate.c | 4 ++++ + test/Makefile.am | 1 + + test/test-0089.sh | 14 ++++++++++++++ + test/test-config.89.in | 4 ++++ + 4 files changed, 23 insertions(+) + create mode 100755 test/test-0089.sh + create mode 100644 test/test-config.89.in + +diff --git a/logrotate.c b/logrotate.c +index d110d54..31161bb 100644 +--- a/logrotate.c ++++ b/logrotate.c +@@ -2515,6 +2515,10 @@ static int writeState(const char *stateFilename) + char *prevCtx; + int force_mode = 0; + ++ if (!strcmp(stateFilename, "/dev/null")) ++ /* explicitly asked not to write the state file */ ++ return 0; ++ + localtime_r(&nowSecs, &now); + + tmpFilename = malloc(strlen(stateFilename) + 5 ); +diff --git a/test/Makefile.am b/test/Makefile.am +index f1a0062..97e5775 100644 +--- a/test/Makefile.am ++++ b/test/Makefile.am +@@ -87,6 +87,7 @@ TEST_CASES = \ + test-0086.sh \ + test-0087.sh \ + test-0088.sh \ ++ test-0089.sh \ + test-0092.sh \ + test-0100.sh \ + test-0101.sh \ +diff --git a/test/test-0089.sh b/test/test-0089.sh +new file mode 100755 +index 0000000..c586690 +--- /dev/null ++++ b/test/test-0089.sh +@@ -0,0 +1,14 @@ ++#!/bin/sh ++ ++. ./test-common.sh ++ ++# skip the test if /dev/null is not readable ++test -r /dev/null || exit 77 ++ ++# we don't want any stuff left from previous runs ++cleanup 89 ++ ++# ------------------------------- Test 89 ------------------------------------ ++# using /dev/null as state file tells logrotate not to write the state file ++preptest test.log 89 2 ++$RLR --state /dev/null test-config.89 +diff --git a/test/test-config.89.in b/test/test-config.89.in +new file mode 100644 +index 0000000..ec41c37 +--- /dev/null ++++ b/test/test-config.89.in +@@ -0,0 +1,4 @@ ++&DIR&/test.log { ++ daily ++ rotate 2 ++} diff -Nru logrotate-3.18.0/debian/patches/series logrotate-3.18.0/debian/patches/series --- logrotate-3.18.0/debian/patches/series 2022-01-30 16:29:14.000000000 +0000 +++ logrotate-3.18.0/debian/patches/series 2023-06-30 17:45:16.000000000 +0000 @@ -13,6 +13,7 @@ applied-upstream/Do-not-lock-state-file-dev-null.patch applied-upstream/skip-locking-if-state-file-is-world-readable.patch applied-upstream/drop-world-readable-permission-on-state-file.patch +applied-upstream/writeState-do-nothing-if-state-file-is-dev-null.patch debian/skip-cronjob-when-running-with-systemd.patch debian/logrotate.conf-disable-dateext-on-Debian.patch debian/replace-ELF-header-in-test-case.patch