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

From: Lars Ingebrigtsen <[email-masked]>
Date: Mon, 30 Sep 2019 16:04:09 +0200

Juanma Barranquero <[email-masked]> writes:

> On Mon, Sep 30, 2019 at 10:46 AM Eli Zaretskii <[email-masked]> wrote:
>
>> You are saying that -unknown is in this case the same as -alpha.
>
> In fact, Lars gave it priority -4, so like a snapshot.
>
>> My problem is how to be sure this is the case everywhere where -unknown
>> could be used.
>
> True, but if -unknown is really uncommon, we can deal with the problems as
> they are reported (if ever).

Looking at the code, just keeping this in epg* is really awkward,
because we compare the version strings afterwards (in other contexts)
with version<=, which will then fail.

So I think this patch is needed to fix the epg problem.  But I'm not
confident that it won't change behaviour for other users of these
version functions.

On the other hand, we have been adding to this alist over the years
without anything blowing up (that I know of), so perhaps it is safe-ish?
If it turns out to be a problem, it's easy enough to back out (but then
I don't really know how to fix the original epg problem in a sensible
manner).

diff --git a/lisp/subr.el b/lisp/subr.el
index 45b99a82d2..efe530cd54 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -5285,6 +5285,8 @@ version-regexp-alist
     ("^[-._+]$"                                           . -4)
     ;; treat "1.2.3-CVS" as snapshot release
     ("^[-._+ ]?\\(cvs\\|git\\|bzr\\|svn\\|hg\\|darcs\\)$" . -4)
+    ;; treat "-unknown" the same as snapshots.
+    ("^[-._+ ]?unknown$"                                  . -4)
     ("^[-._+ ]?alpha$"                                    . -3)
     ("^[-._+ ]?beta$"                                     . -2)
     ("^[-._+ ]?\\(pre\\|rc\\)$"                           . -1))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no