Control: found -1 3.4.2-1
Control: severity -1 serious
Control: tags -1 patch

On Fri, 2019-12-20 at 19:05:23 +0100, Tomas Pospisek wrote:
> Package: spamassassin
> Version: 3.4.2-1+deb10u1
> Severity: important

> It seems that updating spamassassin will remove sysv start links:
> 
>     root@mail /etc # ls -l rc**/*spam*
>     lrwxrwxrwx 1 root root 22 Dez 20 18:45 rc0.d/K02spamassassin -> 
> ../init.d/spamassassin
>     lrwxrwxrwx 1 root root 22 Dez 20 18:45 rc1.d/K02spamassassin -> 
> ../init.d/spamassassin
>     lrwxrwxrwx 1 root root 22 Dez 20 18:45 rc2.d/K03spamassassin -> 
> ../init.d/spamassassin
>     lrwxrwxrwx 1 root root 22 Dez 20 18:45 rc3.d/K03spamassassin -> 
> ../init.d/spamassassin
>     lrwxrwxrwx 1 root root 22 Dez 20 18:45 rc4.d/K03spamassassin -> 
> ../init.d/spamassassin
>     lrwxrwxrwx 1 root root 22 Dez 20 18:45 rc5.d/K03spamassassin -> 
> ../init.d/spamassassin
>     lrwxrwxrwx 1 root root 22 Dez 20 18:45 rc6.d/K02spamassassin -> 
> ../init.d/spamassassin
> 
>     root@mail ~ # update-rc.d spamassassin enable
> 
>     root@mail /etc # ls -l rc**/*spam*
>     lrwxrwxrwx 1 root root 22 Dez 20 18:45 rc0.d/K02spamassassin -> 
> ../init.d/spamassassin
>     lrwxrwxrwx 1 root root 22 Dez 20 18:45 rc1.d/K02spamassassin -> 
> ../init.d/spamassassin
>     lrwxrwxrwx 1 root root 22 Dez 20 18:45 rc2.d/S03spamassassin -> 
> ../init.d/spamassassin
>     lrwxrwxrwx 1 root root 22 Dez 20 18:45 rc3.d/S03spamassassin -> 
> ../init.d/spamassassin
>     lrwxrwxrwx 1 root root 22 Dez 20 18:45 rc4.d/S03spamassassin -> 
> ../init.d/spamassassin
>     lrwxrwxrwx 1 root root 22 Dez 20 18:45 rc5.d/S03spamassassin -> 
> ../init.d/spamassassin
>     lrwxrwxrwx 1 root root 22 Dez 20 18:45 rc6.d/K02spamassassin -> 
> ../init.d/spamassassin

> Notice the S* links.
> 
>     root@mail /etc # LC_ALL=C apt reinstall spamassassin
>     Reading package lists... Done
>     Building dependency tree
>     Reading state information... Done
>     0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not 
> upgraded.
>     Need to get 0 B/1126 kB of archives.
>     After this operation, 0 B of additional disk space will be used.
>     [master 6e2d3db] saving uncommitted changes in /etc prior to apt run
>      Author: Tomas Pospisek
>      5 files changed, 1 insertion(+)
>      rename rc2.d/{K03spamassassin => S03spamassassin} (100%)
>      rename rc3.d/{K03spamassassin => S03spamassassin} (100%)
>      rename rc4.d/{K03spamassassin => S03spamassassin} (100%)
>      rename rc5.d/{K03spamassassin => S03spamassassin} (100%)
>      create mode 120000 
> systemd/system/multi-user.target.wants/spamassassin.service
>     (Reading database ... 38518 files and directories currently installed.)
>     Preparing to unpack .../spamassassin_3.4.2-1+deb10u1_all.deb ...
>     Unpacking spamassassin (3.4.2-1+deb10u1) over (3.4.2-1+deb10u1) ...
>     Setting up spamassassin (3.4.2-1+deb10u1) ...
>     Processing triggers for man-db (2.8.5-2) ...
>     [master 26b1b46] committing changes in /etc made by "apt reinstall 
> spamassassin"
>      Author: Tomas Pospisek
>      5 files changed, 1 deletion(-)
>      rename rc2.d/{S03spamassassin => K03spamassassin} (100%)
>      rename rc3.d/{S03spamassassin => K03spamassassin} (100%)
>      rename rc4.d/{S03spamassassin => K03spamassassin} (100%)
>      rename rc5.d/{S03spamassassin => K03spamassassin} (100%)
>      delete mode 120000 
> systemd/system/multi-user.target.wants/spamassassin.service
>     Scanning processes...                                                     
>                                                                               
>                
>     Scanning candidates...                                                    
>                                                                               
>                

I updated my server some weeks ago to bullseye, and noticed this, but
shrugged it off as a fluke or similar due to my use of policy-rc.d
to disallow actions during the upgrade, but today when upgrading
spamassassin again (this time w/o a policy-rc.d in place), the links
got disabled once more. Setting severity to serious as this does not
preserve user configuration. :)

The problem seems to stem from commit
955194996671416bd9712bfefe82c4847a7f2a5b which dropped the ENABLED
variable support from /etc/default/spamassassin but forgot to also
remove the handling of that variable from the postinst, which means
that even if the daemon is running it will be forcefully disabled.

I think the attached patch should fix this.

Thanks,
Guillem
From 708350a7406a9c7703157c30a04f7e0a667988cb Mon Sep 17 00:00:00 2001
From: Guillem Jover <guil...@debian.org>
Date: Sat, 15 May 2021 08:24:07 +0200
Subject: [PATCH] Finish partial removal of ENABLED handling

While the init script is still left supporting the variable being set
to 0 to disallow the execution of the service, we stop supporting the
variable on configure as otherwise this forcefully disables the service
on upgrades on sysvinit systems, even when the daemon is currently
running, as ENABLED is now gone from /etc/default/spamassassin, which
means the user configuration will not be preserved anymore.

Closes: #947086
---
 debian/spamassassin.README.Debian |  4 ++--
 debian/spamassassin.postinst      | 37 -------------------------------
 debian/tests/daemon               |  3 ---
 3 files changed, 2 insertions(+), 42 deletions(-)

diff --git a/debian/spamassassin.README.Debian b/debian/spamassassin.README.Debian
index 8816222..886a40e 100644
--- a/debian/spamassassin.README.Debian
+++ b/debian/spamassassin.README.Debian
@@ -78,8 +78,8 @@ spamd, the daemonized form of spamassassin, is generally the preferred
 way of running spamassassin. Please read man spamd and README.spamd
 for more information. Spamd is disabled by default on Debian
 installations. To enable it, use "systemctl enable spamassassin" on
-systems using systemd, or edit /etc/default/spamassassin and set
-ENABLED=1 for systems using other init systems. To change the command
+systems using systemd, or "update-rc.d spamassassin enable" for systems
+using other init systems. To change the command
 line options, please edit /etc/default/spamassassin.
 
 If you intend to use Bayes sitewide, it is recommended that you set up
diff --git a/debian/spamassassin.postinst b/debian/spamassassin.postinst
index 914b363..ee54626 100644
--- a/debian/spamassassin.postinst
+++ b/debian/spamassassin.postinst
@@ -45,43 +45,6 @@ fi
 
 #DEBHELPER#
 
-# Note: the following mess should go away as soon as possible after
-# the next stable release to complete the transition away from using
-# ENABLED=1 in /etc/default/spamassassin
-if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || \
-       [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
-    set +e
-    invoke-rc.d --query spamassassin start
-    code=$?
-    set -e
-    ENABLED=0
-    if [ -f /etc/default/spamassassin ]; then
-	. /etc/default/spamassassin
-    fi
-    if [ $code -eq 104 ] && \
-	    ! command -v systemctl > /dev/null ; then
-	# We're not using systemd and thus may have some sysvinit cleanup
-	# to do in order to comply with policy 9.3.3.1
-
-	if [ -z "$ENABLED" -o "$ENABLED" = 0 ]; then
-	    # The rc?d symlinks are inconsistent with the value set in
-	    # /etc/default/spamassassin. Update the symlinks to
-	    # reflect the actual state.
-	    update-rc.d -f spamassassin remove
-	    update-rc.d -f spamassassin defaults-disabled
-	    deb-systemd-helper disable spamassassin.service
-	fi
-    elif [ $code -eq 101 ] && \
-	     command -v systemctl > /dev/null && \
-	     [ $ENABLED -eq 1 ]; then
-	# We're running on a systemd system, and the service is not
-	# configured to start (the default), but the admin has
-	# previously enabled it via
-	# /etc/default/spamassassin. Preserve that configuration.
-	deb-systemd-helper enable spamassassin.service
-    fi
-fi
-
 if [ "$1" = "configure" ] && [ -n "$2" ]; then
     if deb-systemd-helper was-enabled spamassassin.service > /dev/null 2>&1; then
 	invoke-rc.d spamassassin restart
diff --git a/debian/tests/daemon b/debian/tests/daemon
index ac140a7..136e72e 100644
--- a/debian/tests/daemon
+++ b/debian/tests/daemon
@@ -4,9 +4,6 @@
 #----------------------------
 set -e
 
-# modify /etc/default/spamassassin to enable the daemon
-CONFIG_FILE=/etc/default/spamassassin
-sed -i -e "s/ENABLED=0/ENABLED=1/g" $CONFIG_FILE
 /etc/init.d/spamassassin restart >/dev/null 2>&1
 
 if pgrep spamd > /dev/null; then
-- 
2.31.1.498.g6c1eba8ee3d

Reply via email to