On Sat Sep 5, 2026 at 10:02 PM CEST, Holger Levsen wrote:
> On Sat, Sep 05, 2026 at 09:07:14PM +0200, Serafeim (Serafi) Zanikolas wrote:
>> Holger, is there anything holding this back, or is it just a case of 
>> preparing
>> a patch? (happy to do so, in the latter case).

please find a revised patch attached.

all credit to you, I just did the rubber duck :)

thanks,
serafi
From 8c9611bb6e9fce40552f3e05378f6a1f275cf01f Mon Sep 17 00:00:00 2001
From: "Serafeim (Serafi) Zanikolas" <[email protected]>
Date: Sun, 13 Sep 2026 21:37:57 +0200
Subject: [PATCH] best-pkging-practices: add expectations on postinst
 robustness. Closes: #801065.

---
 source/best-pkging-practices.rst | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/source/best-pkging-practices.rst b/source/best-pkging-practices.rst
index 3dea1c4..cc3cebb 100644
--- a/source/best-pkging-practices.rst
+++ b/source/best-pkging-practices.rst
@@ -574,6 +574,9 @@ that isn't handled merely by the creation or removal of files and
 directories. The following instructions supplement the `Debian
 Policy <https://www.debian.org/doc/debian-policy/>`__.
 
+Generic guidelines
+--------------------------------------------------------------------------------------------------------------------------------
+
 Maintainer scripts must be idempotent. That means that you need to make
 sure nothing bad will happen if the script is called twice where it
 would usually be called once.
@@ -612,6 +615,26 @@ shell-builtin for many shells and is defined in POSIX.
 Using ``which`` is an acceptable alternative, since it is from the required 
 ``debianutils`` package.
 
+Expected behavior of complex postinst scripts
+--------------------------------------------------------------------------------------------------------------------------------
+
+``postinst`` scripts must normally not fail, except for very rare cases.
+These are cases where postinst must succeed:
+
+on fresh installs:
+   - the service configuration is straightforward and can be reasonably
+     expected to work as-is in typical Debian setups
+   - the service has no external dependencies (e.g. a database which may not
+     yet be configured, or unreachable at install time)
+
+on upgrades:
+   - ``postinst`` can verify with high confidence (which may not always be
+     feasible) that the service was running prior to the restart
+   - the service has no external dependencies or ``postinst`` can verify that
+     they are functional
+   - the service configuration has not changed in backwards incompatible ways
+     between the old and new package versions
+
 .. _bpp-config-mgmt:
 
 Configuration management with ``debconf``
-- 
2.47.3

Attachment: signature.asc
Description: PGP signature

Reply via email to