summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/opkg-utils/opkg-utils/0001-update-alternatives-correctly-match-priority.patch
blob: 556d4ce5f5e2a5eb2495620da7a7158ec979c7fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From 26206005dacd61380663bb4fd9b18178bb33665b Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Sat, 24 Oct 2020 21:59:27 +0200
Subject: [PATCH] update-alternatives: correctly match priority

It should always be at the end of string, otherwise something
like "/usr/bin/python3.9-config 123" will erroneously match
against priority 9.

Upstream-Status: Submitted
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
 update-alternatives | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/update-alternatives b/update-alternatives
index 1389b3f..e0b31bf 100644
--- a/update-alternatives
+++ b/update-alternatives
@@ -94,7 +94,7 @@ add_alt() {
 	local path="$2"
 	local priority="$3"
 	remove_alt $name $path
-	if grep -qw "$priority" $ad/$name; then
+	if grep -qw "$priority"$ $ad/$name; then
 		echo "Warn: update-alternatives: $name has multiple providers with the same priority, please check $ad/$name for details"
 	fi
 	echo "$path $priority" >> $ad/$name