Skip to content

Commit

Permalink
Only use gpgconf result if the file exists (#1903)
Browse files Browse the repository at this point in the history
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <[email protected]>
  • Loading branch information
dominikschulz authored Apr 5, 2021
1 parent 8d281a0 commit 00ee33a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/backend/crypto/gpg/cli/binary_others.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os/exec"

"github.com/gopasspw/gopass/pkg/debug"
"github.com/gopasspw/gopass/pkg/fsutil"
"github.com/gopasspw/pinentry/gpgconf"
)

Expand All @@ -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")
Expand Down

0 comments on commit 00ee33a

Please sign in to comment.