Hello everyone, In SUSE we noticed that some of our python packages were not updating their alternatives when migrating from ie python2.6 to python2.7. This is due to unfortunate priority set by the maintainers of such packages to be equal between py2.6 and py2.7 while pointing to different files (eg /usr/bin/pip-2.6 vs /usr/bin/pip-2.7). The correct fix that is being implemented is to update the priorities to be correctly bumped when this happens in the packages. But for the safer world we would also like include patch (see attachment) that forces the update even if the priorities are the same. So we can be safe against this kind of mistakes in future. Would this be acceptable for you guys to merge? Also additional to this is there some argument that would nicely force update of all already broken links on the system? Something like "update-alternatives --all --non-interactive" to simply rehash all the auto files to be updated if their links are dangling. I basically just need to avoid the interactive mode where there are multiple selection. TIA Tom
From 9f73659ce9b9194ce2f0219afbfb77d27e90508b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tchvatal@suse.com> Date: Wed, 6 Apr 2016 20:06:15 +0200 Subject: [PATCH] In case of equal priority rather update This is needed because in some cases priorities in openSUSE python packages were equal in priority yet pointing to different files. With forced refresh we unfortunately update in some un-needed cases but are safe against this kind of errors. --- utils/update-alternatives.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c index 5dc3213..1af65a4 100644 --- a/utils/update-alternatives.c +++ b/utils/update-alternatives.c @@ -1437,7 +1437,8 @@ alternative_get_best(struct alternative *a) best = a->choices; for (fs = a->choices; fs; fs = fs->next) - if (fs->priority > best->priority) + /* In case of equal priority rather use the new alternative */ + if (fs->priority >= best->priority) best = fs; return best; -- 2.7.4
Attachment:
signature.asc
Description: This is a digitally signed message part