tags 801065 + patch
tags 801065 - moreinfo
thanks

hi Holger, thanks for the feedback.

On Mon Jun 1, 2026 at 9:08 PM CEST, Holger Levsen wrote:
> On Fri, May 29, 2026 at 10:50:10PM +0200, Serafeim (Serafi) Zanikolas wrote:
[..]
>> fwiw I wonder whether this would be of much use. "typical Debian setups" is
>> ambiguous. verifying whether a remote service is unreachable is not always
>> straightforward. "backwards incompatible" is not always black and white.
>
> I think this is still useful, despite its not all black and white, maybe
> especially because its not black and white.

please find a lightly edited version attached as a patch.

thanks,
serafi
From 18b25192ea75abe9a912de97846e8ceaabcc66e6 Mon Sep 17 00:00:00 2001
From: "Serafeim (Serafi) Zanikolas" <[email protected]>
Date: Mon, 1 Jun 2026 22:39:43 +0200
Subject: [PATCH] best-pkging-practices: when failing postinst might be
 appropriate. Closes #801065.

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

diff --git a/source/best-pkging-practices.rst b/source/best-pkging-practices.rst
index 3dea1c4..fc570c7 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,33 @@ 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
+--------------------------------------------------------------------------------------------------------------------------------
+
+Failing from a ``postinst`` script is very disruptive and should not be taken
+lightly:
+
+-  A service failing to start upon a fresh install should, in general,
+   fail ``postinst``, if
+
+   - 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)
+
+-  A service failing to restart upon an upgrade should, in general, fail
+   ``postinst`` if
+
+   - ``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