The following commit has been merged in the master branch:
commit 7f1940a118fba31d0927d817a094ea2b41c0474f
Author: Guillem Jover <[email protected]>
Date: Wed Feb 6 02:06:20 2013 +0100
u-a: Use the current alternative link as the first best value
This makes sure that if there are several alternatives with the same
priority, the current one will always be preferred, regardless of how
they sort alphabetically.
Closes: #699807
diff --git a/debian/changelog b/debian/changelog
index dfa3c37..9485842 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,9 @@ dpkg (1.17.0) UNRELEASED; urgency=low
* Do not use “header” when “format” or “field” is meant in man pages.
* Use colon instead of dot for user:group in dpkg debug output.
* Remove support for obsolete DM-Upload-Allowed from Dpkg::Vendor::Debian.
+ * Fix update-alternatives to use the current alternative link as the first
+ best value, to avoid flip-flops of alternatives with equal priority.
+ Closes: #699807
-- Guillem Jover <[email protected]> Fri, 03 Aug 2012 13:21:00 +0200
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 88c49e6..2b8e600 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -1445,8 +1445,18 @@ static struct fileset *
alternative_get_best(struct alternative *a)
{
struct fileset *fs, *best;
+ const char *current;
+
+ current = alternative_get_current(a);
+ if (current)
+ best = alternative_get_fileset(a, current);
+ else
+ best = NULL;
+
+ if (best == NULL)
+ best = a->choices;
- for (best = fs = a->choices; fs; fs = fs->next)
+ for (fs = a->choices; fs; fs = fs->next)
if (fs->priority > best->priority)
best = fs;
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]