[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#409374: postinst not idempotent: adds duplicate lines to ld.so.hwcappkgs



Package: libc6-xen
Version: 2.3.6.ds1-10
Severity: normal
Tags: patch

(Technically a policy violation, but the result seems relatively harmless,
therefore I left the Severity at normal.)

The postinst parses /etc/ld.so.hwcappkgs and if there is already a line for
libc6-xen, it sets $isrecorded (line 30). Only if this is not set in line 40
another line for libc6-xen is added to the file.

The problem is that line 30 is in a sub-shell so the setting of $isrecorded
does not propagate to line 40 (outer shell). The attached patch fixes that.

diff -u /var/lib/dpkg/info/libc6-xen.postinst /tmp/libc6-xen.postinst
--- /var/lib/dpkg/info/libc6-xen.postinst	2007-02-02 14:37:56.000000000 +0100
+++ /tmp/libc6-xen.postinst	2007-02-02 14:37:57.000000000 +0100
@@ -36,10 +36,10 @@
 		fi
 	    fi
 	    echo "$pkg $ver" >> /etc/ld.so.hwcappkgs.tmp
-	done) < /etc/ld.so.hwcappkgs
+	done
 	if [ "$isrecorded" != yes ]; then
 	    echo "$opt $curver" >> /etc/ld.so.hwcappkgs.tmp
-	fi
+	fi) < /etc/ld.so.hwcappkgs
 	mv /etc/ld.so.hwcappkgs.tmp /etc/ld.so.hwcappkgs
     else
 	# libc6 did not create ld.so.hwcappkgs correctly or ld.so.hwcappkgs

Reply to: