From 0bddfa4100df486c722e6f6bbe65521899d00073 Mon Sep 17 00:00:00 2001 From: Sean Millichamp Date: Fri, 28 Jun 2024 10:25:26 -0400 Subject: [PATCH] Ensure rpm --whatprovides is deduplicated Some RPM packages may have provides such that the package matches the query multiple times, causing RPM to return the package name multiple times. This change ensures that if that occurs it is properly deduplicated. --- tasks/linux.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasks/linux.sh b/tasks/linux.sh index 93ad473..0dab975 100755 --- a/tasks/linux.sh +++ b/tasks/linux.sh @@ -109,8 +109,9 @@ case "$available_manager" in # yum install and rpm -q may produce different results because one package may provide another # For example, 'vim' can be installed because the 'vim-enhanced' package provides 'vim' - # So, find out the exact package to get the status for - provided_package="$(rpm -q --whatprovides "$name")" || provided_package= + # So, find out the exact package to get the status for. Ensure the results are de-duplicated + # for packages which may match the whatprovides query more than once. + provided_package="$(rpm -q --whatprovides "$name" | sort -u)" || provided_package= # - is the syntax for installing a specific version in yum [[ $version ]] && full_name="${name}-${version}" || full_name="${name}"