Package: dpkg
Version: 1.4.0.31
Severity: important

The Debian jdk1.1 and jdk1.1-dev packages are one of the heaviest users
of update-alternatives.  Over the years, several versions of the jdk packages
have had bugs, resulting in stale entries in /var/lib/dpkg/alternatives.

Some of the stale entries are preventing the new jdk1.1 packages from
being installed on some systems that had the old buggy packages
installed.

Here's a simple patch against update-alternatives which removes stale
entries when update-alternatives is run.  I'd really like to see this
fixed for slink, and it would solve some release-critical problems.

Cheers,

 - Jim



--- update-alternatives.debian  Sat Dec 19 12:04:25 1998
+++ update-alternatives Sat Dec 19 12:58:02 1998
@@ -110,14 +110,23 @@
     }
     while (($version= &gl("version")) ne '') {
         defined($versionnum{$version}) && &badfmt("duplicate path $tver");
-        push(@versions,$version);
-        $versionnum{$version}= $i= $#versions;
-        $priority= &gl("priority");
-        $priority =~ m/^[-+]?\d+$/ || &badfmt("priority $version $priority");
-        $priorities[$i]= $priority;
-        for ($j=0; $j<=$#slavenames; $j++) {
-            $slavepath{$i,$j}= &gl("spath");
-        }
+       if ( -r $version ) {
+           push(@versions,$version);
+           $versionnum{$version}= $i= $#versions;
+           $priority= &gl("priority");
+           $priority =~ m/^[-+]?\d+$/ || &badfmt("priority $version 
$priority");
+           $priorities[$i]= $priority;
+           for ($j=0; $j<=$#slavenames; $j++) {
+               $slavepath{$i,$j}= &gl("spath");
+           }
+       } else {
+           # File not found - remove
+            &pr("Alternative for $name points to $version - which wasn't 
found.  Removing from list of alternatives.");
+           &gl("priority");
+           for ($j=0; $j<=$#slavenames; $j++) {
+               &gl("spath");
+           }
+       }
     }
     close(AF);
     $dataread=1;



-- System Information
Debian Release: slink
Kernel Version: Linux fleming 2.1.131 #1 SMP Wed Dec 2 18:48:33 PST 1998 i586 
unknown

Versions of the packages dpkg depends on:
ii  libc6           2.0.7u-7.1     The GNU C library version 2 (run-time files)
ii  libncurses4     4.2-3          Shared libraries for terminal handling
ii  libstdc++2.9    2.91.60-1      The GNU stdc++ library (egcs version)

Reply via email to