Control: tags -1 + patch

On 2013-02-13 06:20 +0600, Andrey Rahmatullin wrote:

> Package: libc6
> Version: 2.17-0experimental2
> Severity: wishlist
> Filing as wishlist, maybe it's minor or even worse for some people.
> The postinst script of libc6 checks services that need to be restarted not
> taking into account that those services may be of a different arch and so not
> using the libc6 being upgraded. That also means when you upgrade both
> libc6:amd64 and libc6:i386 you get double restart of all those services.

Today, upgrading libc6:amd64 and libc6:i386 to 2.29-1, I got annoyed by
this again and had a look what needs to be done.  The attached patch
(lightly tested, I have only a few amd64 and no i386 services running)
appears to do the trick.  It also drops the need for awk in the
maintainer scripts.

Feedback and brave testers welcome!


From 8d3ef80d688b71503dc369b68bf0323349e9fbda Mon Sep 17 00:00:00 2001
From: Sven Joachim <>
Date: Mon, 9 Sep 2019 13:46:28 +0200
Subject: [PATCH 1/1] Do not restart services of different architecture than

Only check services in packages which are of the same architecture, or
"arch:all".  This is most easily done by replacing the rather
convoluted way of parsing "dpkg --status" output by switching to a
more suitable output format of dpkg-query.  As a bonus, awk is no
longer used in the maintscripts.

Note that services in architecture-independent packages like
postgresql-common will still be restarted twice, since there is no
obvious way to tell the architecture of the actual binaries which need
to be re-executed.
 debian/ | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/debian/ b/debian/
index 80dfd2fb..623278c0 100644
--- a/debian/
+++ b/debian/
@@ -1,6 +1,8 @@
 	    echo -n "Checking for services that may need to be restarted..."
-	    # Only get the ones that are installed, and configured
-	    check=$(dpkg -s $check 2> /dev/null | egrep '^Package:|^Status:' | awk '{if ($1 ~ /^Package:/) { package=$2 } else if ($0 ~ /^Status: .* installed$/) { print package }}')
+	    # Only get the ones that are installed, of the same architecture
+	    # as libc (or arch all) and configured
+	    check=$(dpkg-query -W -f='${binary:Package} ${Status} ${Architecture}\n' $check 2> /dev/null | \
+			grep -E "installed (all|${DPKG_MAINTSCRIPT_ARCH})$" | sed 's/[: ].*//')
 	    # some init scripts don't match the package names
 	    check=$(echo $check | \
 		    sed -e's/\bapache2.2-common\b/apache2/g' \

Reply via email to