Package: runit-services
Version: 0.7.2
Severity: normal
Tags: patch

Dear Maintainer,

Since the last stable release, the default environment provided for
exim4 on new installations uses a different set of variables to
configure the daemon. As a result, the current runscript fails to launch
exim4 because it fails to provide a queue runner interval value to the
-q flag, leading to the following error being logged by svlogd:

exim: incompatible command-line options or arguments

On a default out-of-the box installation, the following command line
would have been attempted:

/usr/sbin/exim4 -bd -d -q

The change that broke this runscript is "Switch to EXIMDAEMONOPTS":

https://salsa.debian.org/exim-team/exim4/-/commit/ea38b9fddb71d1b5e9a125ca3a2ce7b7cfae0898

I attach a patch which fixes this by using the new EXIMSERVICE options
and providing a default value for this same.

Another important failure to support out-of-the box installations is
that the update-exim4.conf script is not run. This patch also fixes this
and does so on 'sv hup exim4' too.

Thank you!


-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.11.2-amd64 (SMP w/32 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: runit (via /run/runit.stopit)
LSM: AppArmor: enabled

Versions of packages runit-services depends on:
ii  runit         2.1.2-60
ii  runit-helper  2.16.4

Versions of packages runit-services recommends:
ii  runit-init  2.1.2-60

Versions of packages runit-services suggests:
pn  socklog  <none>

-- no debconf information
>From 84916d09416d8ab05d43911f5c7e43a010532fff Mon Sep 17 00:00:00 2001
From: Andrew Bower <[email protected]>
Date: Sat, 9 Nov 2024 14:55:24 +0000
Subject: [PATCH] exim4: fix exim4 launch with trixie default env

Since the change to the default environment shipped after bookworm in
<https://salsa.debian.org/exim-team/exim4/-/commit/ea38b9fddb71d1b5e9a125ca3a2ce7b7cfae0898>
the runscript for exim4 will by default attempt to start the daemon with
invalid command line arguments (namely missing queue runner interval):

2024-11-09_14:17:13.18129 /usr/sbin/exim4 -bd -d -q
2024-11-09_14:17:13.18358 exim: incompatible command-line options or arguments

This patch fixes this by using the new EXIMSERVICE default and providing
a default for that variable matching other init systems.

Additionally, this runscript omits an invocation of update-exim4.conf to
assemble the debian autogenerated config where applicable. This patch
does so on launch and on HUP.

Defaults from pre-trixie configurations are used by preference if present.
---
 debian/changelog   |  2 +-
 sv/exim4/control/h |  4 ++++
 sv/exim4/run       | 18 ++++++++++++++----
 3 files changed, 19 insertions(+), 5 deletions(-)
 create mode 100755 sv/exim4/control/h

diff --git a/debian/changelog b/debian/changelog
index 4be4965..9c430b5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-runit-services (0.7.3) UNRELEASED; urgency=medium
+runit-services (0.7.3~0ajb.6) UNRELEASED; urgency=medium
 
   * new changelog entry, for testing
 
diff --git a/sv/exim4/control/h b/sv/exim4/control/h
new file mode 100755
index 0000000..b76d24c
--- /dev/null
+++ b/sv/exim4/control/h
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+/usr/sbin/update-exim4.conf $UPEX4OPTS
+false
diff --git a/sv/exim4/run b/sv/exim4/run
index 7c4f3da..ccc40fc 100755
--- a/sv/exim4/run
+++ b/sv/exim4/run
@@ -1,11 +1,18 @@
 #!/usr/bin/env /lib/runit/invoke-run
 #Copyright: 2022 Lorenzo Puliti <[email protected]>
+#Copyright: 2024 Andrew Bower <[email protected]>
 #License: CC0-1.0
 
 exec 2>&1
 
-# only works for "combined" configuration mode
-QUEUERUNNER='combined'
+# Compatibility with defaults file carried over from pre-trixie installations
+if [ -n 
"$QUEUERUNNER$QUEUEINTERVAL$COMMONOPTIONS$QUEUERUNNEROPTIONS$QFLAGS$SMTPLISTENEROPTIONS"
 ]
+then
+  EXIMSERVICE=${EXIMSERVICE--bdf -q${QFLAGS}${QUEUEINTERVAL} $COMMONOPTIONS 
$QUEUERUNNEROPTIONS $SMTPLISTENEROPTIONS}
+else
+  EXIMSERVICE=${EXIMSERVICE--bdf -q30m}
+fi
+
 [ -d /run/exim4 ] || \
   install -d -oDebian-exim -gDebian-exim -m750 /run/exim4
 LANG=C
@@ -14,5 +21,8 @@ export LANG
 if [ -e /etc/runit/verbose ]; then
         echo "invoke-run: starting ${PWD##*/}"
 fi
-#-bdf is also ok but no log to stdout for svlogd
-exec ##bin## -bd -d -q${QFLAGS}${QUEUEINTERVAL} $COMMONOPTIONS 
$QUEUERUNNEROPTIONS $SMTPLISTENEROPTIONS
+
+# '-d' option appended to provide debug output for svlogd
+
+/usr/sbin/update-exim4.conf $UPEX4OPTS
+exec ##bin## $EXIMSERVICE -d
-- 
2.45.2

Reply via email to