Просмотр исходного кода

u-a: Fix segfault in --auto on link groups with only dangling symlinks

All the invalid alternative entries will get removed so it might happen
that the link group ends up empty. Handle that explicitly on --auto.

Closes: #611545
Guillem Jover лет назад: 15
Родитель
Сommit
19a571d40f
2 измененных файлов с 12 добавлено и 1 удалено
  1. 7 0
      debian/changelog
  2. 5 1
      utils/update-alternatives.c

+ 7 - 0
debian/changelog

@@ -1,3 +1,10 @@
+dpkg (1.15.8.10) UNRELEASED; urgency=low
+
+  * Do not segfault on “update-alternatives --auto” when the link group only
+    has alternatives which are dangling symlinks. Closes: #611545
+
+ -- Guillem Jover <guillem@debian.org>  Sun, 30 Jan 2011 19:04:04 +0100
+
 dpkg (1.15.8.9) unstable; urgency=low
 
   [ Raphaël Hertzog ]

+ 5 - 1
utils/update-alternatives.c

@@ -2323,7 +2323,11 @@ main(int argc, char **argv)
 		alternative_set_status(a, ALT_ST_MANUAL);
 	} else if (strcmp(action, "auto") == 0) {
 		alternative_set_status(a, ALT_ST_AUTO);
-		new_choice = alternative_get_best(a)->master_file;
+		if (alternative_choices_count(a) == 0)
+			pr(_("There is no program which provides %s."),
+			   a->master_name);
+		else
+			new_choice = alternative_get_best(a)->master_file;
 	} else if (strcmp(action, "config") == 0) {
 		if (alternative_choices_count(a) == 0) {
 			pr(_("There is no program which provides %s."),