The following commit has been merged in the squeeze branch:
commit 19a571d40fdb3cdbff8ea3910aaafdcf706a1892
Author: Guillem Jover <[email protected]>
Date:   Sun Jan 30 19:14:37 2011 +0100

    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

diff --git a/debian/changelog b/debian/changelog
index 4c22f90..3e761ad 100644
--- a/debian/changelog
+++ b/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 <[email protected]>  Sun, 30 Jan 2011 19:04:04 +0100
+
 dpkg (1.15.8.9) unstable; urgency=low
 
   [ Raphaël Hertzog ]
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 1636225..b141630 100644
--- a/utils/update-alternatives.c
+++ b/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."),

-- 
dpkg's main repository


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

Reply via email to