Control: tag -1 patch

On 27/06/2023 19.21, Richard Lewis wrote:
header.txt has not been modified since 2015.

I've found three versions (with sightly different spelling):
* lenny
* squeeze, wheezy, jessie
* stretch .. today

it is a simple yext file that is installed with debian/logcheck.install

the only change is that it used to be installed into /usr/share but got
moved to /etc to be a conffile in 2021. This didnt trigger any piuparts
issues and there was no change to the contents of header.txt.

It has been copied during initial install only and was never upgraded. If the system was installed before stretch, the header.txt does not match the current one and dpkg will complain when replacing it with a proper conffile.

So i dont understand how piuparts found an issue - is it possible to tell
us what difference piuparts actually detected?

dpkg found that the files are different. This is a non-default piuparts test, testing every package starting from jessie (or even earlier) and upgrading release by release to testing takes a lot of time (and didn't finish before the release happened), but sometimes reveals interesting things ;-)

Attached patch should fix this long upgrade path. The preinst checks whether header.txt matches a known shipped (but not current) variant and tries to update it to the current variant. It seems to work fine when starting from jessie, more tests will be running over night.

Andreas

PS: please don't mix this fix with other changes not intended for bookworm, s.t. it can go to sid as 1.4.3 and be rebuilt for bookworm as 1.4.3~deb12u1 in order not to break the version constraints
From 869fcc671751e3a5309848541df2d82744cdfba8 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <a...@debian.org>
Date: Tue, 27 Jun 2023 21:29:06 +0200
Subject: [PATCH] update ancient header.txt in preinst

---
 debian/changelog        |  8 ++++++++
 debian/logcheck.preinst | 21 +++++++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 debian/logcheck.preinst

diff --git a/debian/changelog b/debian/changelog
index 3c46c56e..567896a7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+logcheck (1.4.3) UNRELEASED; urgency=medium
+
+  * Add logcheck.preinst to upgrade header.txt if it matches a known shipped
+    version predating stretch to avoid dpkg complaining about a modified
+    conffile.  (Closes: #1039591)
+
+ -- Andreas Beckmann <a...@debian.org>  Tue, 27 Jun 2023 20:05:42 +0200
+
 logcheck (1.4.2) unstable; urgency=medium
 
   * More explicitly mention the default checking of the systemd journal
diff --git a/debian/logcheck.preinst b/debian/logcheck.preinst
new file mode 100644
index 00000000..a2bc04d0
--- /dev/null
+++ b/debian/logcheck.preinst
@@ -0,0 +1,21 @@
+#!/bin/sh
+set -e
+
+if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then
+	if dpkg --compare-versions "$2" lt-nl "1.4.3~" ; then
+		# Update /etc/logcheck/header.txt if it matches a known
+		# shipped version predating stretch to avoid dpkg
+		# complaining about a modified conffile
+		if [ -f "/etc/logcheck/header.txt" ] && [ -f "/usr/share/logcheck/header.txt" ]; then
+			# d9206d89f2f8d85d346a23da90459862 (lenny)
+			# a32fc12d69628d96756fd3af3f8b3ecd (squeeze-jessie)
+			md5=$(md5sum "/etc/logcheck/header.txt" | awk '{print $1}')
+			if [ "$md5" = "d9206d89f2f8d85d346a23da90459862" ] ||
+			   [ "$md5" = "a32fc12d69628d96756fd3af3f8b3ecd" ]; then
+				cp -p -v /usr/share/logcheck/header.txt /etc/logcheck
+			fi
+		fi
+	fi
+fi
+
+#DEBHELPER#
-- 
2.20.1

Reply via email to