Package: matrix-sydent
Version: 2.5.1-1.1
Severity: serious
User: jo...@debian.org
Usertags: adduserpurge
Control: tag -1 + patch

Hi,

the packages passwd and adduser are not part of the Essential:yes set.
According to policy §7.2 maintainer scripts cannot assume them being installed
when purging a package.  If one tries to remove this package without adduser
(which depends on passwd) installed, one gets:

--%<-------------------------------------------------------------------------
Purging configuration files for matrix-sydent (2.5.1-1.1) ...
/var/lib/dpkg/info/matrix-sydent.postrm: 28: deluser: not found
dpkg: error processing package matrix-sydent (--purge):
 installed matrix-sydent package post-removal script subprocess returned error 
exit status 127
Errors were encountered while processing:
 matrix-sydent
-->%-------------------------------------------------------------------------

There is ongoing discussion how to handle system users on package
removal, see https://bugs.debian.org/621833

For a discussion about use of adduser during purge, see #1035654.

To work around this problem, at least 125 source packages [codesearch] simply
ignore failures of calling the passwd or adduser tools during purge. The
following patch should fix this package by doing the same:

--%<-------------------------------------------------------------------------
diff -Nru matrix-sydent-2.5.1/debian/postrm matrix-sydent-2.5.1/debian/postrm
--- matrix-sydent-2.5.1/debian/postrm   2021-06-01 21:17:05.000000000 +0200
+++ matrix-sydent-2.5.1/debian/postrm   2023-05-10 07:46:13.000000000 +0200
@@ -25,7 +25,7 @@
                dpkg-statoverride --force-all --quiet --remove "${DIR}"
        done
 
-       getent passwd "${USER}" >/dev/null && deluser "${USER}"
+       getent passwd "${USER}" >/dev/null && deluser "${USER}" || true
 
        rm -f /var/lib/${NAME}/*
        if [ -d /var/lib/${NAME} ]; then
-->%-------------------------------------------------------------------------

If you prefer I can fix this via an NMU.

Thanks!

cheers, josch

[codesearch] 
https://codesearch.debian.net/search?q=del%28user%7Cgroup%29.*%5C%7C%5C%7C+true+path%3Adebian%2F.*%5C.%28pre%7Cpost%29rm%24&literal=0

Reply via email to