The following commit has been merged in the master branch:
commit 2cf5b0f90d4fae8c6287fa0a44e84270ad5326d6
Author: Raphael Hertzog <[email protected]>
Date: Tue Jun 23 08:58:35 2009 +0200
Remove all invalid master alternatives found
Initially I wanted to cleanup only problematic cases thinking that there
would be few. But apparently there must be an old version of
update-alternatives that created improper entries for slave alternatives
in /var/lib/dpkg/alternatives so I do a full scan once when we upgrade
from a version older than 1.15.3 and hope that we can forget about those
upgrade issues after that.
diff --git a/debian/changelog b/debian/changelog
index 1bc039f..0f4a079 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,8 +9,8 @@ dpkg (1.15.3) UNRELEASED; urgency=low
[ Raphael Hertzog ]
* Unset TAR_OPTIONS when creating/extracting tar archives for source
packages. Closes: #530860
- * Add cleanup of known invalid (master) alternatives in preinst script.
- Closes: #530633, #531611, #532739
+ * Add cleanup of all invalid (master) alternatives in preinst script.
+ Closes: #530633, #531611, #532739, #521760
* Let update-alternatives fix a manual alternative with a dangling symlink
by switching it to automatic mode. Closes: #529999
* Add missing paragraph separator in dpkg-buildpackage(1). Thanks to Per
diff --git a/debian/dpkg.lintian-overrides b/debian/dpkg.lintian-overrides
index d6dbc6e..80de3c2 100644
--- a/debian/dpkg.lintian-overrides
+++ b/debian/dpkg.lintian-overrides
@@ -3,3 +3,8 @@ dpkg: redundant-bugs-field
dpkg: arch-dep-package-has-big-usr-share
# By design, to be able to recover from broken/missing zlib
dpkg: embedded-zlib ./usr/bin/dpkg-deb
+# False positives, we read from a file not from a tty
+dpkg: read-in-maintainer-script preinst:38
+dpkg: read-in-maintainer-script preinst:39
+dpkg: read-in-maintainer-script preinst:41
+dpkg: read-in-maintainer-script preinst:49
diff --git a/debian/dpkg.preinst b/debian/dpkg.preinst
index c33d78f..4469819 100755
--- a/debian/dpkg.preinst
+++ b/debian/dpkg.preinst
@@ -26,15 +26,30 @@ upgrade_dpkg_non_conffile()
fi
}
-clean_alternative()
-{
+kill_bad_alternatives () {
+ local IFS=""
ALTDIR="/var/lib/dpkg/alternatives"
- if [ -e "$ALTDIR/$2" ]; then
- if [ -e "$ALTDIR/$1" ] && grep -q "^$2$" "$ALTDIR/$1"; then
- echo "Removing conflicting alternative $2 ..."
- rm -f "$ALTDIR/$2"
+ for alt in $ALTDIR/*; do
+ if [ ! -e $alt ]; then
+ # In case it's been removed by the code below
+ continue
fi
- fi
+ {
+ read mode
+ read mainlink
+ while true; do
+ read slave
+ if [ "$slave" = "" ]; then
+ break
+ fi
+ if [ -e "$ALTDIR/$slave" ]; then
+ echo "Removing conflicting master alternative $slave (it
is slave of $(basename $alt))..."
+ rm -f "$ALTDIR/$slave"
+ fi
+ read slavelink
+ done
+ } <$alt
+ done
}
case "$1" in
@@ -43,11 +58,10 @@ case "$1" in
upgrade)
# Cleanup bad alternatives that would choke with new
- # update-alternatives (see #530633, #531611, #532739)
- clean_alternative x-terminal-emulator x-terminal-emulator.1.gz
- clean_alternative x-session-manager x-session-manager.1.gz
- clean_alternative x-window-manager x-window-manager.1.gz
- clean_alternative awk nawk
+ # update-alternatives (see #530633, #531611, #532739, #521760)
+ if dpkg --compare-versions "$2" lt 1.15.3; then
+ kill_bad_alternatives
+ fi
case "$2" in
# Upgrade from pre-conffile dpkg.cfg
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]