[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1039994: marked as done (bullseye-pu: package logrotate/3.18.0-2+deb11u2)



Your message dated Sat, 07 Oct 2023 12:41:28 +0100
with message-id <84bb5ff8312f749ebe536897993782bf35aa1977.camel@adam-barratt.org.uk>
and subject line Closing opu requests for updates included in 11.8
has caused the Debian Bug report #1039994,
regarding bullseye-pu: package logrotate/3.18.0-2+deb11u2
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
1039994: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039994
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Control: affects -1 + src:logrotate
User: release.debian.org@packages.debian.org
Usertags: pu
Tags: bullseye
Severity: normal

[ Reason ]
The previous upload (3.18.0-2+deb11u1) cherry picked several commits
around the state file handling of logrotate.
In particular debian/patches/applied-upstream/Do-not-lock-state-file-dev-null.patch
added the following wording to the man page:

    If /dev/null is given as the state file, then logrotate will not
try to lock or write the state file.

In the current bullseye version this is only true for locking but nor
for writing since the related commit was not included.
Thus the usage of /dev/null as the state file can lead to /dev/null
being replaced by a regular file.
See #1039868 as an example.

[ Impact ]
Users might be instructed by the man page to use /dev/null as a
throwaway state file and end up with /dev/null being replaced with a
regular file.

[ Tests ]
The testsuite of logrotate passes and there have been no issues in
logrotate versions that include that commit, in particular 3.21.0,
which is the version in Debian stable and unstable.

[ Risks ]
The change is a single trivial added path comparison to skip the state
file writing iff the state file is literal "/dev/null". There is no
change in behavior if the state file is not "/dev/null".

[ Checklist ]
 [X] *all* changes are documented in the d/changelog
 [X] I reviewed all changes and I approve them
 [X] attach debdiff against the package in (old)stable
 [X] the issue is verified as fixed in unstable

[ Changes ]
Skip writing the state to the file iff the path is literal "/dev/null".
Add a test case around using /dev/null as a state file.

[ Other info ]

diff -Nru logrotate-3.18.0/debian/changelog logrotate-3.18.0/debian/changelog
--- logrotate-3.18.0/debian/changelog   2022-01-30 17:29:14.000000000 +0100
+++ logrotate-3.18.0/debian/changelog   2023-06-30 19:45:16.000000000 +0200
@@ -1,3 +1,10 @@
+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 <cgzones@googlemail.com>  Fri, 30 Jun 2023
19:45:16 +0200
+
logrotate (3.18.0-2+deb11u1) stable; urgency=medium

  * d/patches: cherry-pick upstream fixes:
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 01:00:00.000000000 +0100
+++ logrotate-3.18.0/debian/patches/applied-upstream/writeState-do-nothing-if-state-file-is-dev-null.patch
     2023-06-30 19:45:16.000000000 +0200
@@ -0,0 +1,76 @@
+From: Kamil Dudka <kdudka@redhat.com>
+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
17:29:14.000000000 +0100
+++ logrotate-3.18.0/debian/patches/series      2023-06-30
19:45:16.000000000 +0200
@@ -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

--- End Message ---
--- Begin Message ---
Package: release.debian.org
Version: 11.8

Hi,

The updates referred to by each of these requests were included in
today's 11.8 bullseye point release.

Regards,

Adam

--- End Message ---

Reply to: