[Pkg-shadow-devel] Bug#989712: delete cruft from passwd and login maintainer scripts

Helmut Grohne helmut at subdivi.de
Fri Jun 11 07:03:05 BST 2021


Source: shadow
Version: 1:4.8.1-1
Tags: patch

The maintainer scripts have accumulated a bit of obsolete code over
time. This code becomes problematic as we are in the process of changing
the installation bootstrap. Less code means less things we touch.
Therefore, I ask for cleaning up this code. In detail:

 * The code for dealing with logoutd can be removed, because it was
   already absent in buster (probably longer) and we don't support skip
   upgrades.
 * The creation of /etc/subuid and /etc/subgid is duplicated inside
   login.postinst. Initialize only once.
 * login.preinst and passwd.preinst handle upgrades from pre 1:4.0.3 and
   can be deleted.

Please consider applying the attached patch.

Helmut
-------------- next part --------------
diff --minimal -Nru shadow-4.8.1/debian/changelog shadow-4.8.1/debian/changelog
--- shadow-4.8.1/debian/changelog	2020-02-07 15:54:14.000000000 +0100
+++ shadow-4.8.1/debian/changelog	2021-06-11 07:55:31.000000000 +0200
@@ -1,3 +1,13 @@
+shadow (1:4.8.1-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Remove obsolete upgrade code from maintainer scripts. (Closes: #-1)
+    + logoutd is gone since at least buster.
+    + Delete duplicate subuid/subgid creation.
+    + Delete preinsts upgrading from 1:4.0.3.
+
+ -- Helmut Grohne <helmut at subdivi.de>  Fri, 11 Jun 2021 07:55:31 +0200
+
 shadow (1:4.8.1-1) unstable; urgency=medium
 
   * debian/default/useradd: Fix typo DHSELL -> DSHELL (Closes: #897028)
diff --minimal -Nru shadow-4.8.1/debian/login.postinst shadow-4.8.1/debian/login.postinst
--- shadow-4.8.1/debian/login.postinst	2020-02-07 15:54:14.000000000 +0100
+++ shadow-4.8.1/debian/login.postinst	2021-06-11 07:53:36.000000000 +0200
@@ -2,18 +2,5 @@
 
 set -e
 
-if test "$1" = configure
-then
-	if test -f /etc/init.d/logoutd
-	then 
-		if test "$(md5sum /etc/init.d/logoutd)" = "9080f92783dd53f6f2108e698c06bd53  /etc/init.d/logoutd"
-		then	
-			echo "removing logoutd cruft"
-			rm /etc/init.d/logoutd
-			update-rc.d logoutd remove
-		fi
-	fi
-fi
-rm -f /etc/pam.d/login.pre-upgrade 2>/dev/null
 
 if [ "$1" = "configure" ]; then
@@ -38,19 +26,6 @@
 	fi
 fi
 
-        # Create subuid/subgid if missing
-        if [ ! -e /etc/subuid ]; then
-                touch /etc/subuid
-                chown root:root /etc/subuid
-                chmod 644 /etc/subuid
-        fi
-
-        if [ ! -e /etc/subgid ]; then
-                touch /etc/subgid
-                chown root:root /etc/subgid
-                chmod 644 /etc/subgid
-        fi
-
 #DEBHELPER#
 
 exit 0
diff --minimal -Nru shadow-4.8.1/debian/login.preinst shadow-4.8.1/debian/login.preinst
--- shadow-4.8.1/debian/login.preinst	2020-02-07 15:54:14.000000000 +0100
+++ shadow-4.8.1/debian/login.preinst	1970-01-01 01:00:00.000000000 +0100
@@ -1,52 +0,0 @@
-#! /bin/sh
-
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <new-preinst> `install'
-#        * <new-preinst> `install' <old-version>
-#        * <new-preinst> `upgrade' <old-version>
-#        * <old-preinst> `abort-upgrade' <new-version>
-#
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-remove_md5() {
-    if md5sum $1 2>/dev/null |grep -q $2; then
-	cp $1 $1.pre-upgrade
-	sed -e '/^[^#][ \t]*assword[ \t]*required[ \t]*pam_unix.so/ s/ md5$//' $1 >$1.post-upgrade \
-	    && mv $1.post-upgrade $1
-    fi
-    }
-
-
-case "$1" in
-    install|upgrade)
-        if [ "x$2" != "x" ] ; then
-	    if dpkg --compare-versions $2 lt 1:4.0.3 ; then
-		remove_md5 /etc/pam.d/login 5e61c3334e25625fe1fa4d79cf9123ff
-		fi
-	    fi
-	    
-    ;;
-
-    abort-upgrade)
-    ;;
-
-    *)
-        echo "preinst called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
-
diff --minimal -Nru shadow-4.8.1/debian/passwd.postinst shadow-4.8.1/debian/passwd.postinst
--- shadow-4.8.1/debian/passwd.postinst	2020-02-07 15:54:14.000000000 +0100
+++ shadow-4.8.1/debian/passwd.postinst	2021-06-11 07:54:40.000000000 +0200
@@ -4,19 +4,5 @@
 
 case "$1" in
 configure)
-    # Fix permissions on various log files from old versions of the debian
-    # installer, some unrelated to passwd but we decided to put the fix
-    # here since there was no better place. This can safely be removed
-    # after etch is released.
-    if dpkg --compare-versions "$2" lt "1:4.0.14-9"; then
-	    for log in /var/log/base-config* \
-		    $(find /var/log/debian-installer/ /var/log/installer/ -type f 2>/dev/null ); do
-		if [ -e "$log" ]; then
-			chmod 600 "$log"
-		fi
-            done
-    fi
-
-    rm -f /etc/pam.d/passwd.pre-upgrade 2>/dev/null
 	if ! getent group shadow | grep -q '^shadow:[^:]*:42'
 	then
diff --minimal -Nru shadow-4.8.1/debian/passwd.preinst shadow-4.8.1/debian/passwd.preinst
--- shadow-4.8.1/debian/passwd.preinst	2020-02-07 15:54:14.000000000 +0100
+++ shadow-4.8.1/debian/passwd.preinst	1970-01-01 01:00:00.000000000 +0100
@@ -1,51 +0,0 @@
-#! /bin/sh
-
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <new-preinst> `install'
-#        * <new-preinst> `install' <old-version>
-#        * <new-preinst> `upgrade' <old-version>
-#        * <old-preinst> `abort-upgrade' <new-version>
-#
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-remove_md5() {
-    if md5sum $1 2>/dev/null |grep -q $2; then
-	cp $1 $1.pre-upgrade
-	sed -e '/^[^#]*[ \t]*password[ \t]*required[ \t]*pam_unix.so/ s/ md5$//' $1 >$1.post-upgrade \
-	    && mv $1.post-upgrade $1
-    fi
-    }
-
-
-case "$1" in
-    install|upgrade)
-        if [ "x$2" != "x" ] ; then
-	    if dpkg --compare-versions $2 lt 1:4.0.3 ; then
-		remove_md5 /etc/pam.d/passwd 23a5d1465bbc1e39ca6e0c32f22a75c9
-	    fi
-	fi
-    ;;
-
-    abort-upgrade)
-    ;;
-
-    *)
-        echo "preinst called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
-


More information about the Pkg-shadow-devel mailing list