Fix bug in testing mock
authorJacob Bachmeyer <jcb@gnu.org>
Wed, 26 Oct 2022 02:13:41 +0000 (21:13 -0500)
committerJacob Bachmeyer <jcb@gnu.org>
Wed, 26 Oct 2022 02:13:41 +0000 (21:13 -0500)
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

index a700199a9d93fede7790aa31afe064fb565c0f6e..7e5343c285c65f946157f1e0bf0ffd7b3f787449 100755 (executable)
@@ -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