Package: dpkg
Version: 1.15.8.11
Severity: normal
Tags: patch

During a dist-upgrade from Lenny to Squeeze I noticed some obsolete conffiles
not being removed.

For example the package desktop-base contains a conffile /etc/kde3/kdeglobals,
which should be removed as the package is upgraded to version 6.0.5squeeze1.
Removal of the file is done in preinst and postinst maintainer scripts by
calling dpkg-maintscript-helper.sh. Strangly this script decides to not remove
said file.

My investigation of the problem yielded some (maybe) wrong operators used with
dpkg --compare-versions inside the function rm_conffile (see attached patch).

Cheers,
Tim



-- System Information:
Debian Release: 6.0.3
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.0.8-client (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=de_DE@euro (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash

Versions of packages dpkg depends on:
ii  coreutils               8.5-1            GNU core utilities
ii  libbz2-1.0              1.0.5-6          high-quality block-sorting file co
ii  libc6                   2.11.2-10        Embedded GNU C Library: Shared lib
ii  libselinux1             2.0.96-1         SELinux runtime shared libraries
ii  xz-utils                5.0.0-2          XZ-format compression utilities
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

dpkg recommends no packages.

Versions of packages dpkg suggests:
ii  apt                    0.8.10.3+squeeze1 Advanced front-end for dpkg

-- no debconf information


>From 58695fbf11280b3b569fb94c0f669b112eb21ce9 Mon Sep 17 00:00:00 2001
From: Tim Hartung <[email protected]>
Date: Thu, 10 Nov 2011 18:40:31 +0100
Subject: [PATCH] dpkg-maintscript-helper.sh: Fix wrong comparsion

Due to a wrong operator supplied to dpkg --compare-versions
dpkg-maintscript-helper.sh did not remove obsolete conffiles in
some cases.
---
 scripts/dpkg-maintscript-helper.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/dpkg-maintscript-helper.sh b/scripts/dpkg-maintscript-helper.sh
index 631a5a1..d3f6e3e 100755
--- a/scripts/dpkg-maintscript-helper.sh
+++ b/scripts/dpkg-maintscript-helper.sh
@@ -54,13 +54,13 @@ rm_conffile() {
 	case "$DPKG_MAINTSCRIPT_NAME" in
 	preinst)
 		if [ "$1" = "install" -o "$1" = "upgrade" ] && [ -n "$2" ] &&
-		   dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
+		   dpkg --compare-versions "$2" gt "$LASTVERSION"; then
 			prepare_rm_conffile "$CONFFILE" "$PACKAGE"
 		fi
 		;;
 	postinst)
 		if [ "$1" = "configure" ] && [ -n "$2" ] &&
-		   dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
+		   dpkg --compare-versions "$2" gt "$LASTVERSION"; then
 			finish_rm_conffile $CONFFILE
 		fi
 		;;
@@ -71,7 +71,7 @@ rm_conffile() {
 		fi
 		if [ "$1" = "abort-install" -o "$1" = "abort-upgrade" ] &&
 		   [ -n "$2" ] &&
-		   dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
+		   dpkg --compare-versions "$2" gt "$LASTVERSION"; then
 			abort_rm_conffile "$CONFFILE"
 		fi
 		;;
-- 
1.7.1

Reply via email to