The following commit has been merged in the master branch:
commit 7b1f88470b8c3894cfcf879e523ddf987187cfa8
Author: Raphael Hertzog <hert...@debian.org>
Date:   Thu Feb 5 19:36:59 2009 +0100

    update-alternatives: avoid switching to manual mode broken alternatives
    
    * scripts/update-alternatives.pl: Ensure that a broken link
    in automatic mode doesn't lead to the alternative being set
    on manual mode. Also displays by default (and not only
    when --verbose is given) the message that indicates that
    an alternative is switched to manual mode.

diff --git a/ChangeLog b/ChangeLog
index ed3dbff..dda5d60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,12 @@
 2009-02-05  Raphael Hertzog  <hert...@debian.org>
+
+       * scripts/update-alternatives.pl: Ensure that a broken link
+       in automatic mode doesn't lead to the alternative being set
+       on manual mode. Also displays by default (and not only
+       when --verbose is given) the message that indicates that
+       an alternative is switched to manual mode.
+
+2009-02-05  Raphael Hertzog  <hert...@debian.org>
            Osamu Aoki <os...@debian.org>
 
        * scripts/update-alternatives.pl: Allow --config to continue when
diff --git a/debian/changelog b/debian/changelog
index ed4e9a5..187ca81 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -114,6 +114,10 @@ dpkg (1.15.0) UNRELEASED; urgency=low
     (launched during source build). Closes: #426752, #499924
   * Improve behaviour of update-alternatives --config. Thanks to
     Osamu Aoki <os...@debian.org> for the initial patch.
+  * Fix update-alternatives to not switch to manual mode an alternative
+    with a broken symlink (instead let the current action fix it).
+    Also ensure that a message is displayed by default when such a switch is
+    made. Closes: #141325, #87677
 
   [ Pierre Habouzit ]
   * Add a --query option to update-alternatives. Closes: #336091, #441904
diff --git a/scripts/update-alternatives.pl b/scripts/update-alternatives.pl
index 59d6ac9..34b6395 100755
--- a/scripts/update-alternatives.pl
+++ b/scripts/update-alternatives.pl
@@ -444,7 +444,11 @@ if (defined($linkname= readlink("$altdir/$name"))) {
     } elsif (defined(readlink("$altdir/$name.dpkg-tmp"))) {
         $state= 'expected-inprogress';
     } else {
-        $state= 'unexpected';
+        if (-e $linkname) {
+            $state = 'unexpected';
+        } else {
+            $state = 'nonexistent';
+        }
     }
 } elsif ($! == ENOENT) {
     $state= 'nonexistent';
@@ -475,7 +479,7 @@ if ($action eq 'auto') {
 if ($state eq 'unexpected' && $mode eq 'auto') {
     pr(sprintf(_g("%s has been changed (manually or by a script).\n" .
                   "Switching to manual updates only."), "$altdir/$name"))
-      if $verbosemode > 0;
+        if $verbosemode >= 0;
     $mode = 'manual';
 }
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to