Przeglądaj źródła

update-alternatives: deal with unknown alternatives when fixing a broken link group

Instead of trying to reinstall an alternative that doesn't exist in the
database, select a new choice and install that one.
Raphaël Hertzog 16 lat temu
rodzic
commit
9b369060cb
2 zmienionych plików z 11 dodań i 0 usunięć
  1. 3 0
      debian/changelog
  2. 8 0
      scripts/update-alternatives.pl

+ 3 - 0
debian/changelog

@@ -23,6 +23,9 @@ dpkg (1.15.6) UNRELEASED; urgency=low
   * When unpacking a "3.0 (quilt)" source package, tell quilt where
     patches are (to be) stored. Requires quilt >= 0.48-5 to work.
     Closes: #557619
+  * Fix update-alternatives to not try to reinstall an unknown alternative
+    when the link group is broken, instead switch to the best choice in
+    automatic mode. Closes: #566406
 
   [ Guillem Jover ]
   * Handle argument parsing in dpkg-checkbuilddeps and dpkg-scanpackages

+ 8 - 0
scripts/update-alternatives.pl

@@ -411,6 +411,14 @@ if (defined($new_choice) and ($current_choice ne $new_choice)) {
     warning(_g("forcing reinstallation of alternative %s " .
                "because link group %s is broken."),
             $current_choice, $alternative->name());
+    if ($current_choice and not $alternative->has_choice($current_choice)) {
+	$new_choice = $alternative->best();
+	warning(_g("current alternative %s is unknown, switching to %s " .
+	           "for link group %s."), $current_choice, $new_choice,
+		$alternative->name());
+	$current_choice = $new_choice;
+	$alternative->set_status('auto');
+    }
     $alternative->prepare_install($current_choice) if $current_choice;
 }