0001-update-alternatives-correctly-match-priority.patch 1015 B

12345678910111213141516171819202122232425262728
  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. It should always be at the end of string, otherwise something
  6. like "/usr/bin/python3.9-config 123" will erroneously match
  7. against priority 9.
  8. Upstream-Status: Submitted
  9. Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
  10. ---
  11. update-alternatives | 2 +-
  12. 1 file changed, 1 insertion(+), 1 deletion(-)
  13. diff --git a/update-alternatives b/update-alternatives
  14. index 1389b3f..e0b31bf 100644
  15. --- a/update-alternatives
  16. +++ b/update-alternatives
  17. @@ -94,7 +94,7 @@ add_alt() {
  18. local path="$2"
  19. local priority="$3"
  20. remove_alt $name $path
  21. - if grep -qw "$priority" $ad/$name; then
  22. + if grep -qw "$priority"$ $ad/$name; then
  23. echo "Warn: update-alternatives: $name has multiple providers with the same priority, please check $ad/$name for details"
  24. fi
  25. echo "$path $priority" >> $ad/$name