diff mbox series

[v5,4/5] update-alternatives: correctly match priority

Message ID 20230724204018.352695-4-p.lobacz@welotec.com
State New
Headers show
Series [v5,1/5] opkg-build: make sure destination dir exists | expand

Commit Message

Piotr Ɓobacz July 24, 2023, 8:40 p.m. UTC
From: Alexander Kanavin <alex.kanavin@gmail.com>

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>

%% original patch: 0001-update-alternatives-correctly-match-priority.patch
---
 update-alternatives | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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