blob: 556d4ce5f5e2a5eb2495620da7a7158ec979c7fa [file] [log] [blame]
Andrew Geissler6ce62a22020-11-30 19:58:47 -06001From 26206005dacd61380663bb4fd9b18178bb33665b Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Sat, 24 Oct 2020 21:59:27 +0200
4Subject: [PATCH] update-alternatives: correctly match priority
5
6It should always be at the end of string, otherwise something
7like "/usr/bin/python3.9-config 123" will erroneously match
8against priority 9.
9
10Upstream-Status: Submitted
11Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
12---
13 update-alternatives | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/update-alternatives b/update-alternatives
17index 1389b3f..e0b31bf 100644
18--- a/update-alternatives
19+++ b/update-alternatives
20@@ -94,7 +94,7 @@ add_alt() {
21 local path="$2"
22 local priority="$3"
23 remove_alt $name $path
24- if grep -qw "$priority" $ad/$name; then
25+ if grep -qw "$priority"$ $ad/$name; then
26 echo "Warn: update-alternatives: $name has multiple providers with the same priority, please check $ad/$name for details"
27 fi
28 echo "$path $priority" >> $ad/$name