From 00ee33a0c1384df8cb74308930704d51d0d37e2c Mon Sep 17 00:00:00 2001 From: Dominik Schulz Date: Mon, 5 Apr 2021 18:38:59 +0200 Subject: [PATCH] Only use gpgconf result if the file exists (#1903) RELEASE_NOTES=n/a Signed-off-by: Dominik Schulz --- internal/backend/crypto/gpg/cli/binary_others.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/backend/crypto/gpg/cli/binary_others.go b/internal/backend/crypto/gpg/cli/binary_others.go index 9eb7866b8c..4e5a9abe92 100644 --- a/internal/backend/crypto/gpg/cli/binary_others.go +++ b/internal/backend/crypto/gpg/cli/binary_others.go @@ -6,6 +6,7 @@ import ( "os/exec" "github.com/gopasspw/gopass/pkg/debug" + "github.com/gopasspw/gopass/pkg/fsutil" "github.com/gopasspw/pinentry/gpgconf" ) @@ -16,8 +17,8 @@ func detectBinary(name string) (string, error) { } // try to get the proper binary from gpgconf(1) p, err := gpgconf.Path("gpg") - if err != nil || p == "" { - debug.Log("gpgconf failed, falling back to path lookup: %q", err) + if err != nil || p == "" || !fsutil.IsFile(p) { + debug.Log("gpgconf failed (%q), falling back to path lookup: %q", p, err) // otherwise fall back to the default and try // to look up "gpg" return exec.LookPath("gpg")