On Mon, 20 Dec 2021 23:21:39 +0100 =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <uklei...@debian.org> wrote:
Hello,

Hello Uwe,

I just encountered the same problem. Digging into it (and before having
found this bug in the BTS) I saw the postinst script of pcscd restarts
the daemon twice. Once explicitly in debian/pcscd.postinst:

        case "$1" in
            configure|reconfigure)
                        # restart pcscd (PCSC daemon)
                        invoke-rc.d pcscd restart
            ;;

and again later added by dh_installinit/13.5.2:

        if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] 
|| [ "$1" = "abort-remove" ] ; then
                if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/pcscd" ]; then
                        update-rc.d pcscd defaults >/dev/null
                        invoke-rc.d --skip-systemd-native pcscd restart || exit 
1
                fi
        fi

I added the first "restart" by hand in
https://salsa.debian.org/debian/pcsc-lite/-/commit/9bf51b9f1bd362dfce3fb6976aa2ce520487a433
to fix #995814

The second "restart" call is added by dh_installinit as you noted.

My fix is not correct. pcscd WAS already restarted on install or
upgrade. I had not checked myself what Philipp wrote in #995814.
Thanks for the notice.

Even if you consider it a bug to mask pcscd.socket but not pcscd.service
(I disagree BTW), I still ask you to remove the explicit call to
invoke-rc.d pcscd restart, as the snippet added by dh_installinit should
serve the same purpose and this doesn't fail with pcscd.socket masked.

Done in https://salsa.debian.org/debian/pcsc-lite/-/commit/935e0eaeaa02fdd1bef30c6f1a93db571a027fbb

The latter invocation of invoke-rc.d is also better as it honors policy
9.3.3 "Maintainer scripts for packages including init scripts must use
update-rc.d [...]." So keeping the status quo might even justify a
serious severity for this bug.

(Note: There is one relevant difference, where I'm unsure if the snippet
added by dh_installinit is better: The explicit call also triggers for
$1 == reconfigure.)

It should not be a problem to NOT restart pcscd in case of "reconfigure"
because the same pcscd binary was already present. A restart is not
needed in this case.

Thanks for your comments.

Bye

Reply via email to