Subject: bug#37556: gpg "-unknown" version string

From: Juanma Barranquero <[email-masked]>
Date: Mon, 30 Sep 2019 00:59:18 +0200

Package: emacs
Version: 27.0.50
X-Debbugs-Cc: [email-masked]

This is related to bug# 35629.

This commit

   commit 42ba6200af10c00c72ac13912d6fb42a7af88058
   Author: Lars Ingebrigtsen <[email-masked]>
   Date:   2019-08-26 08:02:31 +0200

       Allow finding gpg2 binaries when gpg2 has an "unknown" version string

       * lisp/epg-config.el (epg-find-configuration): Allow finding a
       usable configuration even if the version string looks like "gpg
       (GnuPG) 2.2.15-unknown" (bug#35629).

fixes one function, but there are other uses of version-related functions
in epg, for example

(defun epg-required-version-p (protocol required-version)
  "Verify a sufficient version of GnuPG for specific protocol.
PROTOCOL is symbol, either `OpenPGP' or `CMS'.  REQUIRED-VERSION
is a string containing the required version number.  Return
non-nil if that version or higher is installed."
  (let ((version (cdr (assq 'version (epg-find-configuration protocol)))))
    (and (stringp version)
         (version<= required-version version))))

which calls epg-find-configuration (which is protected by the above
change), and then version<= (which fails).

This makes epg-tests.el fail on my gpg, from MSYS2:

$ gpg --version
gpg (GnuPG) 2.2.17-unknown
libgcrypt 1.8.4

Fixing this with another let binding around `version<=' is trivial, but it
is a kludge.

I think it makes more sense just adding "-unknown" to the formats
recognized by default with version-regexp-alist.

(Note: after working around this bug, epg tests still fail for me, but for
unrelated reasons.)