Package: zsh,zsh-static
Version: 5.9-1
Tags: patch
Severity: serious
Justification: Debian policy 10.7.3

When upgrading or reinstalling zsh or zsh-static, it adds /bin/zsh or
/bin/zsh-static respectively to /etc/shells even if one locally removed
it there. Such behaviour violates Debian policy section 10.7.3. I
propose managing the entry declaratively using dpkg triggers and am
attaching a patch for your convenience.

Helmut
diff --minimal -Nru zsh-5.9/debian/changelog zsh-5.9/debian/changelog
--- zsh-5.9/debian/changelog    2022-05-15 01:20:26.000000000 +0200
+++ zsh-5.9/debian/changelog    2022-11-02 10:35:53.000000000 +0100
@@ -1,3 +1,10 @@
+zsh (5.9-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Manage /etc/shells using dpkg triggers. (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Wed, 02 Nov 2022 10:35:53 +0100
+
 zsh (5.9-1) unstable; urgency=low
 
   * [73d31738,d4d20348,2ae4a398] Import new upstream release 5.9.
diff --minimal -Nru zsh-5.9/debian/control zsh-5.9/debian/control
--- zsh-5.9/debian/control      2022-05-15 01:17:30.000000000 +0200
+++ zsh-5.9/debian/control      2022-11-02 10:35:51.000000000 +0100
@@ -56,7 +56,8 @@
 Architecture: any
 Depends: zsh-common (= ${source:Version}),
          ${misc:Depends},
-         ${shlibs:Depends}
+         ${shlibs:Depends},
+         debianutils (>= 5.3-1~)
 Pre-Depends: ${misc:Pre-Depends}
 Recommends: ${shlibs:Recommends}
 Suggests: zsh-doc
@@ -88,7 +89,8 @@
 
 Package: zsh-static
 Architecture: any
-Depends: ${misc:Depends}
+Depends: ${misc:Depends},
+         debianutils (>= 5.3-1~)
 Recommends: zsh-common
 Suggests: zsh-doc
 Built-Using: ${Built-Using}
diff --minimal -Nru zsh-5.9/debian/rules zsh-5.9/debian/rules
--- zsh-5.9/debian/rules        2022-02-25 11:41:52.000000000 +0100
+++ zsh-5.9/debian/rules        2022-11-02 10:35:22.000000000 +0100
@@ -158,6 +158,8 @@
          xargs sed -e 's@\.\./config\.h@config.h@;s@#\(\s*\)include 
"\([^"]\+\)"@#\1include <zsh/\2>@' -i
 
        cd debian/zsh-dev/usr/share/aclocal; mv aczshoot.m4 zshoot.m4
+       install -D -m644 debian/zsh.shells 
debian/zsh/usr/share/debianutils/shells.d/zsh
+       install -D -m644 debian/zsh-static.shells 
debian/zsh-static/usr/share/debianutils/shells.d/zsh-static
 
 override_dh_gencontrol-arch:
        dh_gencontrol -a -- -VBuilt-Using="$(BUILT_USING)"
diff --minimal -Nru zsh-5.9/debian/zsh-static.postinst 
zsh-5.9/debian/zsh-static.postinst
--- zsh-5.9/debian/zsh-static.postinst  2022-02-12 20:54:36.000000000 +0100
+++ zsh-5.9/debian/zsh-static.postinst  2022-11-02 10:33:49.000000000 +0100
@@ -4,9 +4,6 @@
 
 case "$1" in
     (configure)
-#    if test -z "$2"; then
-           add-shell /bin/zsh-static
-#    fi
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
diff --minimal -Nru zsh-5.9/debian/zsh-static.postrm 
zsh-5.9/debian/zsh-static.postrm
--- zsh-5.9/debian/zsh-static.postrm    2022-02-12 20:54:36.000000000 +0100
+++ zsh-5.9/debian/zsh-static.postrm    1970-01-01 01:00:00.000000000 +0100
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-set -e
-
-case "$1" in
-       (remove)
-       remove-shell /bin/zsh-static
-       ;;
-esac
-
-#DEBHELPER#
diff --minimal -Nru zsh-5.9/debian/zsh-static.shells 
zsh-5.9/debian/zsh-static.shells
--- zsh-5.9/debian/zsh-static.shells    1970-01-01 01:00:00.000000000 +0100
+++ zsh-5.9/debian/zsh-static.shells    2022-11-02 10:33:46.000000000 +0100
@@ -0,0 +1 @@
+/bin/zsh-static
diff --minimal -Nru zsh-5.9/debian/zsh.postinst zsh-5.9/debian/zsh.postinst
--- zsh-5.9/debian/zsh.postinst 2022-02-12 20:54:36.000000000 +0100
+++ zsh-5.9/debian/zsh.postinst 2022-11-02 10:34:19.000000000 +0100
@@ -12,9 +12,6 @@
 
 case "$1" in
     (configure)
-        add-shell /bin/zsh
-        add-shell /usr/bin/zsh
-
        # New hardcoded symlinks which unfortunately can't be shipped inside
        # the package itself since some people want to merge /bin and /usr/bin
        # against FHS and all Unix tradition.
diff --minimal -Nru zsh-5.9/debian/zsh.postrm zsh-5.9/debian/zsh.postrm
--- zsh-5.9/debian/zsh.postrm   2022-02-12 20:54:36.000000000 +0100
+++ zsh-5.9/debian/zsh.postrm   2022-11-02 10:34:27.000000000 +0100
@@ -4,9 +4,6 @@
 
 case "$1" in
        (remove)
-       remove-shell /bin/zsh
-       remove-shell /usr/bin/zsh
-
        # Remove hardcoded symlink again
        if [ -L /usr/bin/zsh ]; then
          rm -f /usr/bin/zsh
diff --minimal -Nru zsh-5.9/debian/zsh.shells zsh-5.9/debian/zsh.shells
--- zsh-5.9/debian/zsh.shells   1970-01-01 01:00:00.000000000 +0100
+++ zsh-5.9/debian/zsh.shells   2022-11-02 10:34:14.000000000 +0100
@@ -0,0 +1,2 @@
+/bin/zsh
+/usr/bin/zsh

Reply via email to