Bug#352546: cyrus21-common: the postinst script doesn't cope with an already existing system user "cyrus"

Michael Lipka lipka at lip.inka.de
Sun Feb 12 16:33:58 UTC 2006


Package: cyrus21-common
Version: 2.1.18-3
Severity: grave
Justification: renders package unusable


today an "apt-get -u dist-upgrade" failed with

	Non-system user cyrus found. I will not overwrite a non-system
	user. Remove the user and reinstall cyrus21-common.

for cyrus21-common and with unmet dependencies for cyrus21-imapd
afterwards.  Removing the user and reinstalling cyrus-common didn't
work either (sorry, I forgot to capture the error message)

Investigation showed that adduser in the "configure-" section of
postinst returns with a non-zero exit code, if the system user to add
is already present and _is_ a system user.  The appended "grep"-code
cannot distinguish a system- from a non-system user and if so would
only have changed the error message.

The included patch changes the behavior of postinst to re-use an
existing cyrus system user, which I believe is, what was intended.

--- postinst.org	2006-01-20 12:47:27.000000000 +0100
+++ postinst	2006-02-12 16:51:06.400370750 +0100
@@ -52,16 +52,23 @@
     configure)
 	# Add the cyrus user (requires adduser >= 3.34)
 	echo "Creating/updating cyrus user account..."
+	. /etc/adduser.conf
 	adduser --system --ingroup mail --home /var/spool/cyrus \
            --shell /bin/sh --disabled-password \
 	   --gecos "Cyrus Mailsystem User"  cyrus >/dev/null 2>&1 || {
-	   if getent passwd | grep -s -q -E '^cyrus:'; then
-		   echo "Non-system user cyrus found. I will not overwrite a non-system" >&2
-		   echo "user. Remove the user and reinstall cyrus21-common." >&2
-		   exit 1
-	   fi
-	   # unknown adduser error, simply exit
-	   exit 1
+	if ! getent passwd | \
+		awk -F: -v FSU=$FIRST_SYSTEM_UID -v LSU=$LAST_SYSTEM_UID '
+		$1 ~/^cyrus/ {
+			if (($3 < FSU) || ($3 > LSU))
+				exit 1
+			else
+				exit 0
+		}'
+	then
+		echo "Non-system user cyrus found. I will not overwrite a non-system" >&2
+		echo "user. Remove the user and reinstall cyrus21-common." >&2
+		exit 1
+	fi
 	}
 
 	# Force correct owner and modes


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14.2
Locale: LANG=C, LC_CTYPE=C (charmap=ISO-8859-1) (ignored: LC_ALL set to en_US)

Versions of packages cyrus21-common depends on:
ii  adduser         3.82                     Add and remove users and groups
ii  debconf [debcon 1.4.70                   Debian configuration management sy
ii  dpkg            1.13.13                  package maintenance system for Deb
ii  gawk            1:3.1.5-1                GNU awk, a pattern scanning and pr
ii  libc6           2.3.5-13                 GNU C Library: Shared libraries an
ii  libdb3          3.2.9-23                 Berkeley v3 Database Libraries [ru
ii  libsasl2        2.1.19-1.9               Authentication abstraction library
ii  libssl0.9.8     0.9.8a-6                 SSL shared libraries
ii  libwrap0        7.6.dbs-8                Wietse Venema's TCP wrappers libra
ii  libzephyr3      2.1.20010518.SNAPSHOT-15 The original "Instant Message" sys
ii  netbase         4.24                     Basic TCP/IP networking system
ii  perl            5.8.8-1                  Larry Wall's Practical Extraction 
ii  postfix [mail-t 2.2.8-9                  A high-performance mail transport 

Versions of packages cyrus21-common recommends:
ii  cyrus21-imapd                 2.1.18-3   Cyrus mail system (IMAP support)

-- debconf-show failed





More information about the Pkg-Cyrus-imapd-Debian-devel mailing list