From a0b65e22103b41fb80c9966edbaac3090dd0a993 Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Tue, 25 Oct 2022 21:13:41 -0500 Subject: [PATCH] Fix bug in testing mock If nonexistent files appear in the keyring list, grep will return an error even if a later keyring contains a match; this will cause the mock tool to incorrectly report not finding a key. This bug was hidden by the main gatekeeper only using one keyring on each gpgv run. --- testsuite/lib/exec/mockgpgv | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testsuite/lib/exec/mockgpgv b/testsuite/lib/exec/mockgpgv index a700199..7e5343c 100755 --- a/testsuite/lib/exec/mockgpgv +++ b/testsuite/lib/exec/mockgpgv @@ -30,10 +30,11 @@ while :; do --keyring) case "$2" in */*) - Keyrings="$Keyrings \"$2\"" + [ -f "$2" ] && Keyrings="$Keyrings \"$2\"" ;; *) - Keyrings="$Keyrings \"${GNUPGHOME}/$2\"" + [ -f "${GNUPGHOME}/$2" ] \ + && Keyrings="$Keyrings \"${GNUPGHOME}/$2\"" ;; esac shift 2 -- 2.25.1