Dear maintainer,
this small fix will solve the problem that sa-compile cannot be installed
while start-stop-daemon is dpkg-diverted. Since I don't know which workflow
you prefer, there's also a merge request for it at
https://salsa.debian.org/debian/spamassassin/-/merge_requests/5
Thanks for your time,
Roel
>From 41840d3b51cf08403d2404693f6e45c9123b53d9 Mon Sep 17 00:00:00 2001
From: Roel van Meer <r...@1afa.com>
Date: Wed, 23 Dec 2020 21:15:07 +0100
Subject: [PATCH] postinst: Fix perms only if dir exists
If spamassassin is installed via the debian installer while
start-stop-daemon is diverted via dpkg-divert, sa-compile will not have
run, so the output dir doesn't exist when the postinst script tries to
change its permissions. That causes an error while configuring
sa-compile.
Fix that by checking if the dir exists.
This may still mean the permissions aren't set properly after the
package has been installed (because dpkg-diverting start-stop-daemon
means that sa-compile hasn't been run), but at least the package
installs now. If you run sa-compile manually afterwards you can set the
permissions correctly afterwards as well.
Closes: #977957
---
debian/sa-compile.postinst | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/debian/sa-compile.postinst b/debian/sa-compile.postinst
index 5056f6c..3f15f22 100644
--- a/debian/sa-compile.postinst
+++ b/debian/sa-compile.postinst
@@ -18,12 +18,14 @@ sa_compile() {
start-stop-daemon --chuid $OWNER:$GROUP --start \
--exec /usr/bin/sa-compile -- --quiet
# Fixup perms -- group and other should be able to
# read and execute, but never write. Works around
# sa-compile's failure to obey umask.
- runuser -u $OWNER -- \
+ if [ -d "$output_dir" ]; then
+ runuser -u $OWNER -- \
chmod -R go-w,go+rX "$output_dir"
+ fi
if command -v invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d --quiet spamassassin status > /dev/null && \
invoke-rc.d spamassassin reload > /dev/null 2>&1 || true
else
/etc/init.d/spamassassin reload > /dev/null 2>&1 || true
--
2.20.1