From b9e58540ac2798b98ee397309f1dfb82c987ea44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sun, 23 Jul 2023 09:18:07 +0200 Subject: [PATCH] pkg/util: don't version nonexisting programs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Anders F Björklund --- pkg/util/util.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/util/util.go b/pkg/util/util.go index bad84fd5e..dd79f91fb 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -56,6 +56,10 @@ func queryPackageVersion(cmdArg ...string) string { // Note: This function is copied from containers/podman libpod/util.go // Please see https://github.com/containers/common/pull/1460 func PackageVersion(program string) string { // program is full path + _, err := os.Stat(program) + if err != nil { + return UnknownPackage + } packagers := [][]string{ {"/usr/bin/rpm", "-q", "-f"}, {"/usr/bin/dlocate", "-F"}, // Debian, Ubuntu (quick)