Bug#1039591: logcheck: prompting due to modified conffiles which were not modified by the user: /etc/logcheck/header.txt

2023-09-16 Thread Mathias Gibbens
On Sun, 2023-08-06 at 15:20 +0100, Richard Lewis wrote:
> A gentle reminder on the last bit of this - getting it into bookworm
> point release. (i think i read somewhere that 12.2 would be at the
> end of august)

  ACK -- the 12.2 point release has been announced for October 7th,
with a processing freeze the weekend prior. I think we should be able
to get the changes done and proposed to the release team by the end of
next week.

>  -- let me know if there's anything i can do to help with this (i
> couldn't find anything listing what it involves!)

  The process for uploads to (old)stable is described here:
https://www.debian.org/doc/manuals/developers-reference/pkgs.html#upload-stable

  I'll contact you directly, off of this bug report so we can
coordinate.

Mathias


signature.asc
Description: This is a digitally signed message part


Bug#1039591: logcheck: prompting due to modified conffiles which were not modified by the user: /etc/logcheck/header.txt

2023-08-15 Thread Santiago Vila

El 29/6/23 a las 22:20, Richard Lewis escribió:


for reasons unknown, when debian introduced header.txt in 2014 it shipped 
header.txt in /usr/share/logcheck and copied it to /etc/logcheck in postinst on 
initial install. Only the file in /etc is ever used.


Hello. There was indeed a good reason for that: The conffile mechanism should 
only be used
when there is a default which satisfies everybody (or almost everybody).

In this case there will be people who will be happy with the default header.txt,
but there will also be people (like me) who prefer not to have any header.txt 
at all.

In my opinion header.txt is one of those files where it is much better
not to be handled via the conffile mechanism. I've just filed a separate bug
for that (#1049412), since deletion is currently unsupported and it should be.

Note: I see there is a "md5sum framework" in place to update the file in
case it's necessary. I have a similar md5sum framework in base-files.postinst
and it works very well. With this framework already in place, I would hope
that switching to the old way of handling header.txt should be easy enough.

Thanks.



Bug#1039591: logcheck: prompting due to modified conffiles which were not modified by the user: /etc/logcheck/header.txt

2023-08-06 Thread Richard Lewis
On Wed, 12 Jul 2023 at 12:20, Mathias Gibbens  wrote:
>
>   Andreas, thanks for the report, and Richard, thanks for your work as
> well. I think the changes look good, and if there's no other concerns
> I'll merge the salsa MR, and upload a new version to unstable. Once
> that's done, I'll also file a bug for uploading the updated version to
> stable-proposed-updates;

A gentle reminder on the last bit of this - getting it into bookworm
point release. (i think i read somewhere
 that 12.2 would be at the end of august)

 -- let me know if there's anything i can do to help with this (i
couldn't find anything listing what it involves!)

im about to set up a merge request to add a systemd timer, and have
some other changes in mind,
but think we should get this bit done first



Bug#1039591: logcheck: prompting due to modified conffiles which were not modified by the user: /etc/logcheck/header.txt

2023-07-12 Thread Mathias Gibbens
  Andreas, thanks for the report, and Richard, thanks for your work as
well. I think the changes look good, and if there's no other concerns
I'll merge the salsa MR, and upload a new version to unstable. Once
that's done, I'll also file a bug for uploading the updated version to
stable-proposed-updates; I know the deadline for the first bookworm
point release is this weekend, so it might get in for 12.1.

Mathias


signature.asc
Description: This is a digitally signed message part


Bug#1039591: logcheck: prompting due to modified conffiles which were not modified by the user: /etc/logcheck/header.txt

2023-07-07 Thread Richard Lewis
https://salsa.debian.org/debian/logcheck/-/merge_requests/18 now has
the patch for this

On Thu, 29 Jun 2023 at 21:36, Richard Lewis
 wrote:
>
> I think you might be missing one md5sum - I found 4 versions in the git repos
>
> #
> for x in $(git log debian/header.txt | awk '/commit/{print $2}'); do
> git show $x:debian/header.txt | md5sum ; done
>
> d9206d89f2f8d85d346a23da90459862  -
> a32fc12d69628d96756fd3af3f8b3ecd  -
> dbc1e8d136180d247b572f6a19c4e92e  -
> 1bc54d3bfb0d1e61104d5780a318ced2  -
> #
>
> the top one being the current version, the middle two the same as you
> found and the one at the end '1bc54...' is from a commit dated
> 2004-04-19 (which might mean when woody was stable, i think, although
> this seems to be the date cvs2svn was run)
>
> presumably, we can then remove all this in trixie (if anyone remembers)
>
> On Wed, 28 Jun 2023 at 13:29, Andreas Beckmann  wrote:
> >
> > New version of the patch fixing a wrong checksum. Now logcheck upgrade
> > paths starting from ancient releases look clean ;-)
> >
> > Andreas



Bug#1039591: logcheck: prompting due to modified conffiles which were not modified by the user: /etc/logcheck/header.txt

2023-06-29 Thread Richard Lewis
I think you might be missing one md5sum - I found 4 versions in the git repos

#
for x in $(git log debian/header.txt | awk '/commit/{print $2}'); do
git show $x:debian/header.txt | md5sum ; done

d9206d89f2f8d85d346a23da90459862  -
a32fc12d69628d96756fd3af3f8b3ecd  -
dbc1e8d136180d247b572f6a19c4e92e  -
1bc54d3bfb0d1e61104d5780a318ced2  -
#

the top one being the current version, the middle two the same as you
found and the one at the end '1bc54...' is from a commit dated
2004-04-19 (which might mean when woody was stable, i think, although
this seems to be the date cvs2svn was run)

presumably, we can then remove all this in trixie (if anyone remembers)

On Wed, 28 Jun 2023 at 13:29, Andreas Beckmann  wrote:
>
> New version of the patch fixing a wrong checksum. Now logcheck upgrade
> paths starting from ancient releases look clean ;-)
>
> Andreas



Bug#1039591: logcheck: prompting due to modified conffiles which were not modified by the user: /etc/logcheck/header.txt

2023-06-29 Thread Richard Lewis
On Tue, 27 Jun 2023, 22:01 Andreas Beckmann,  wrote:

> 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.


thank-you - i  believe understand this now

for reasons unknown, when debian introduced header.txt in 2014 it shipped
header.txt in /usr/share/logcheck and copied it to /etc/logcheck in
postinst on initial install. Only the file in /etc is ever used.

editorial changes were then made, but these only made it into the copy in
/usr/share and no steps were taken to update the file in /etc. So those
upgrading have been using the old version, while new installs got the new
version. This is probably against the spirit of policy but it doesnt look
like anyone noticed.

In bookworm logcheck puts header.txt file directly into /etc/logcheck like
any other conffile. because the content hasnt changed since stretch, this
didnt cause immediate issues.

But people who first installed at an old version will get a confusing
conffile prompt on upgrade to bookworm even though they had never edited
the file and had upgraded to every stable release..wow!

thank-you for this i have learned something

Luckily the header.txt is purely cosmetic - so there shouldnt be other bugs
from this!

>


Bug#1039591: logcheck: prompting due to modified conffiles which were not modified by the user: /etc/logcheck/header.txt

2023-06-28 Thread Andreas Beckmann
New version of the patch fixing a wrong checksum. Now logcheck upgrade 
paths starting from ancient releases look clean ;-)


AndreasFrom a8cd5174cfef50fb344a17377ccc77e82ff4c9cd Mon Sep 17 00:00:00 2001
From: Andreas Beckmann 
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   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 ..263bfba3
--- /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
+			# dbc1e8d136180d247b572f6a19c4e92e (lenny)
+			# a32fc12d69628d96756fd3af3f8b3ecd (squeeze, wheezy, jessie)
+			md5=$(md5sum "/etc/logcheck/header.txt" | awk '{print $1}')
+			if [ "$md5" = "dbc1e8d136180d247b572f6a19c4e92e" ] ||
+			   [ "$md5" = "a32fc12d69628d96756fd3af3f8b3ecd" ]; then
+cp -p -v /usr/share/logcheck/header.txt /etc/logcheck
+			fi
+		fi
+	fi
+fi
+
+#DEBHELPER#
-- 
2.20.1



Bug#1039591: logcheck: prompting due to modified conffiles which were not modified by the user: /etc/logcheck/header.txt

2023-06-27 Thread Andreas Beckmann

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 constraintsFrom 869fcc671751e3a5309848541df2d82744cdfba8 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann 
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   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 ..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



Processed: Re: Bug#1039591: logcheck: prompting due to modified conffiles which were not modified by the user: /etc/logcheck/header.txt

2023-06-27 Thread Debian Bug Tracking System
Processing control commands:

> tag -1 patch
Bug #1039591 [logcheck] logcheck: prompting due to modified conffiles which 
were not modified by the user: /etc/logcheck/header.txt
Added tag(s) patch.

-- 
1039591: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1039591
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems



Bug#1039591: logcheck: prompting due to modified conffiles which were not modified by the user: /etc/logcheck/header.txt

2023-06-27 Thread Richard Lewis
header.txt has not been modified since 2015.

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.

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




On Tue, 27 Jun 2023, 15:30 Andreas Beckmann,  wrote:

> Package: logcheck
> Version: 1.4.2
> Severity: serious
> User: debian...@lists.debian.org
> Usertags: piuparts
>
> Hi,
>
> during a test with piuparts I noticed your package failed the piuparts
> upgrade test because dpkg detected a conffile as being modified and then
> prompted the user for an action. As there is no user input, this fails.
> But this is not the real problem, the real problem is that this prompt
> shows up in the first place, as there was nobody modifying this conffile
> at all, the package has just been installed and upgraded...
>
> This is a violation of policy 10.7.3, see
> https://www.debian.org/doc/debian-policy/ch-files.html#behavior,
> which says "[These scripts handling conffiles] must not ask unnecessary
> questions (particularly during upgrades), and must otherwise be good
> citizens."
>
> https://wiki.debian.org/DpkgConffileHandling should help with figuring
> out how to do this properly.
>
> In https://lists.debian.org/debian-devel/2009/08/msg00675.html and
> followups it has been agreed that these bugs are to be filed with
> severity serious.
>
> From the attached log (scroll to the bottom...):
>
>   Setting up logcheck (1.4.2) ...
>
>   Configuration file '/etc/logcheck/header.txt'
>==> File on system created by you or by a script.
>==> File also in package provided by package maintainer.
>  What would you like to do about it ?  Your options are:
>   Y or I  : install the package maintainer's version
>   N or O  : keep your currently-installed version
> D : show the differences between the versions
> Z : start a shell to examine the situation
>The default action is to keep your current version.
>   *** header.txt (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing
> package logcheck (--configure):
>end of file on stdin at conffile prompt
>   Processing triggers for debianutils (5.7-0.5~deb12anbe1) ...
>   Processing triggers for libc-bin (2.36-9) ...
>   Errors were encountered while processing:
>logcheck
>
>
> This happens up upgrade paths starting in jessie, upgrading release by
> release to bookworm.
>
>
> cheers,
>
> Andreas
>


Bug#1039591: logcheck: prompting due to modified conffiles which were not modified by the user: /etc/logcheck/header.txt

2023-06-27 Thread Andreas Beckmann
Package: logcheck
Version: 1.4.2
Severity: serious
User: debian...@lists.debian.org
Usertags: piuparts

Hi,

during a test with piuparts I noticed your package failed the piuparts
upgrade test because dpkg detected a conffile as being modified and then
prompted the user for an action. As there is no user input, this fails.
But this is not the real problem, the real problem is that this prompt
shows up in the first place, as there was nobody modifying this conffile
at all, the package has just been installed and upgraded...

This is a violation of policy 10.7.3, see
https://www.debian.org/doc/debian-policy/ch-files.html#behavior,
which says "[These scripts handling conffiles] must not ask unnecessary
questions (particularly during upgrades), and must otherwise be good
citizens."

https://wiki.debian.org/DpkgConffileHandling should help with figuring
out how to do this properly.

In https://lists.debian.org/debian-devel/2009/08/msg00675.html and
followups it has been agreed that these bugs are to be filed with
severity serious.

>From the attached log (scroll to the bottom...):

  Setting up logcheck (1.4.2) ...
  
  Configuration file '/etc/logcheck/header.txt'
   ==> File on system created by you or by a script.
   ==> File also in package provided by package maintainer.
 What would you like to do about it ?  Your options are:
  Y or I  : install the package maintainer's version
  N or O  : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
   The default action is to keep your current version.
  *** header.txt (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing package 
logcheck (--configure):
   end of file on stdin at conffile prompt
  Processing triggers for debianutils (5.7-0.5~deb12anbe1) ...
  Processing triggers for libc-bin (2.36-9) ...
  Errors were encountered while processing:
   logcheck


This happens up upgrade paths starting in jessie, upgrading release by
release to bookworm.


cheers,

Andreas


logcheck_1.4.2.log.gz
Description: application/gzip