severity 141325 important
tags 141325 patch
forcemerge 141325 199426 203582 282290 285686 311288 311288
thanks

Hi,

When alternative system has broken link for some reason and only one
package uses that alternative system in manual mode, update-alternative
does not update link properly and exits without action.

This seems to be the root cause of many bug reports. We know that there
are many bad uploads of packages.  In many cases,  their packagers are
convinced to have been fixed those bugs in later upload but those bugs
haunts some user for ever.  (but may not be easily reproduced since few
uses manual mode and this is usually set by --cinfig.)

(I did not merge some packages: 87677, if this is with the same root
cause, I am talking 6-7 year old bug.)

Also the output and behavior of --config is so cryptic even though it is
meant for interactive use for quick and easy inspection and
reconfiguration.  Assuming no sane person will write script based on
--config output, I redesigned --config to enable support not only for
original --set but also for --auto and --display in one command.

Since this bug is causing broken configurations for some machines, I
made this as "important" bug but not critical for RC.  I really wish
some expert to look into this and get it fixed by lenny release.

For dpkg 1.14.22, I hereby attach patch to fix these issues.: 
-------------
--- /usr/sbin/update-alternatives.orig  2008-09-28 21:43:51.000000000 +0900
+++ /usr/sbin/update-alternatives       2008-10-02 02:02:30.000000000 +0900
@@ -253,7 +253,7 @@
 {
     my ($spath, $preferred) = (@_);
 
-    printf STDOUT _g("Using '%s' to provide '%s'.") . "\n", $spath, $name;
+    printf STDOUT _g("Using '%s' to provide '%s' in mode=%s.") . "\n", $spath, 
$name, $mode;
     checked_symlink("$spath","$altdir/$name.dpkg-tmp");
     checked_mv("$altdir/$name.dpkg-tmp", "$altdir/$name");
 
@@ -630,24 +630,24 @@
                  "Nothing to configure.\n"), $name;
        return -1;
     }
-    if ($#versions == 0) {
+    if ($#versions == 0 && $mode eq 'auto' && $best eq 
readlink("$altdir/$name")) {
        print "\n";
-       printf _g("There is only 1 program which provides %s\n".
+       printf _g("There is only 1 program which provides %s properly in auto 
mode\n".
                  "(%s). Nothing to configure.\n"), $name, $versions[0];
        return -1;
     }
     print STDOUT "\n";
     printf(STDOUT _g("There are %s alternatives which provide \`%s'.\n\n".
-                     "  Selection    Alternative\n".
+                     " Selection    Alternative\n".
                      "-----------------------------------------------\n"),
                   $#versions+1, $name);
+    printf(STDOUT "%s        0    %s (auto mode)\n", ($mode eq "auto" && 
readlink("$altdir/$name") eq $best) ? '*' : ' ', $best);
     for (my $i = 0; $i <= $#versions; $i++) {
-       printf(STDOUT "%s%s %8s    %s\n",
-           (readlink("$altdir/$name") eq $versions[$i]) ? '*' : ' ',
-           ($best eq $versions[$i]) ? '+' : ' ',
-           $i+1, $versions[$i]);
+       printf(STDOUT "%s %8s    %s (manual mode) priority=%s\n",
+           (readlink("$altdir/$name") eq $versions[$i] && $mode eq "manual") ? 
'*' : ' ',
+           $i+1, $versions[$i], $priorities[$i]);
     }
-    printf(STDOUT "\n"._g("Press enter to keep the default[*], or type 
selection number: "));
+    printf(STDOUT "\n"._g("Press select number (type enter for the current 
selection[*]): "));
     return 0;
 }
 
@@ -657,14 +657,19 @@
        return if config_message() < 0;
        $preferred=<STDIN>;
        chop($preferred);
-    } until $preferred eq '' || $preferred>=1 && $preferred<=$#versions+1 &&
+    } until $preferred eq '' || $preferred>=0 && $preferred<=$#versions+1 &&
        ($preferred =~ m/[0-9]*/);
     if ($preferred ne '') {
-       $mode = "manual";
-       $preferred--;
-       my $spath = $versions[$preferred];
+        if ($preferred == 0) {
+           $action = "auto";
+           $mode = "auto";
+       } else {
+           $mode = "manual";
+           $preferred--;
+           my $spath = $versions[$preferred];
 
-       set_links($spath, $preferred);
+           set_links($spath, $preferred);
+       }
     }
 }
-------
 
Please note 
    $#versions == 0 && $mode eq 'auto' && $best eq readlink("$altdir/$name)) ...
is the part which let this command not to skip processing if symlink
does not match reality.

I have to confess I have not tested for complicated upgrade situation
yet whrere *.dpkg files in such situation may interfare.  But so far it
looks close to fixing long standing bugs of sinple but essential Debian
tool called update-alyernative :=)

Osamu





-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to