Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 1 | From 26206005dacd61380663bb4fd9b18178bb33665b Mon Sep 17 00:00:00 2001 |
| 2 | From: Alexander Kanavin <alex.kanavin@gmail.com> |
| 3 | Date: Sat, 24 Oct 2020 21:59:27 +0200 |
| 4 | Subject: [PATCH] update-alternatives: correctly match priority |
| 5 | |
| 6 | It should always be at the end of string, otherwise something |
| 7 | like "/usr/bin/python3.9-config 123" will erroneously match |
| 8 | against priority 9. |
| 9 | |
| 10 | Upstream-Status: Submitted |
| 11 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> |
| 12 | --- |
| 13 | update-alternatives | 2 +- |
| 14 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 15 | |
| 16 | diff --git a/update-alternatives b/update-alternatives |
| 17 | index 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 |