From 5b6aeb8d1b3308dcc3ccda7bde15a064a48ad96a Mon Sep 17 00:00:00 2001 From: Matteo Rossini Date: Sun, 16 Feb 2020 22:57:41 +0100 Subject: [PATCH] https://www.linuxquestions.org/questions/slackware-14/slackpkg-1-8-a-4175669481/page3.html#post6090791 slackpkg+-search-fix-wrong-upgrade-info-bug.patch.txt --- src/slackpkgplus.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/slackpkgplus.sh b/src/slackpkgplus.sh index 9fb125f..906c759 100755 --- a/src/slackpkgplus.sh +++ b/src/slackpkgplus.sh @@ -1102,7 +1102,24 @@ if [ "$SLACKPKGPLUS" = "on" ];then for i in ${PRIORITY[@]}; do DIR="$i" if [[ "$DIR" =~ ^[-_[:alnum:]]+[:] ]] ; then # was if echo "$DIR" | grep -q "[a-zA-Z0-9]\+[:]" ; then - DIR=${DIR/:*/} # was DIR=$(echo "$i" | cut -f1 -d":") + DIR=${i/:*/} # was DIR=$(echo "$i" | cut -f1 -d":") + PAT=${i/*:/} + + # when the current priority is of kind :, the loop must be short-circuited + # when SEARCHSTR does not match PATTERN, otherwise, some packages could be mistakenly + # selected. + # + # Example: + # - p7zip is present in alien and boost + # - alien has precedence over boost + # - PKGS_PRIORITY=(boost:infozip) + # - p7zip from alien is installed. + # + # In these case, the priority boost:infozip must be ignored otherwise slackpkg+ will + # wrongly shows boost:p7zip as an upgrade for alien:p7zip + # + + [ ! -z "$PAT" ] && ! echo "$SEARCHSTR" | grep -qw "$PAT" && continue fi if [ "$CMD" == "file-search" ] ; then