From: Lars Ingebrigtsen Date: Thu, 4 Feb 2021 08:25:28 +0000 (+0100) Subject: Fix epg filtering out keys that contain revoked IDs X-Git-Tag: emacs-28.0.90~3949 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a8958640c4d8b17d6bc093d94741565276fa9e5f;p=emacs.git Fix epg filtering out keys that contain revoked IDs * lisp/epg.el (epg--filter-revoked-keys): Only filter out the revoked user ids, not the entire key that contains revoked user ids (bug#46138). --- diff --git a/lisp/epg.el b/lisp/epg.el index b1f37cbbdcf..36794d09a75 100644 --- a/lisp/epg.el +++ b/lisp/epg.el @@ -332,7 +332,6 @@ callback data (if any)." (cl-defstruct (epg-key (:constructor nil) (:constructor epg-make-key (owner-trust)) - (:copier nil) (:predicate nil)) (owner-trust nil :read-only t) sub-key-list user-id-list) @@ -1383,11 +1382,22 @@ NAME is either a string or a list of strings." keys)) (defun epg--filter-revoked-keys (keys) - (seq-remove (lambda (key) - (seq-find (lambda (user) - (eq (epg-user-id-validity user) 'revoked)) - (epg-key-user-id-list key))) - keys)) + (mapcar + (lambda (key) + ;; We have something revoked, so copy the key and remove the + ;; revoked bits. + (if (seq-find (lambda (user) + (eq (epg-user-id-validity user) 'revoked)) + (epg-key-user-id-list key)) + (let ((copy (copy-epg-key key))) + (setf (epg-key-user-id-list copy) + (seq-remove (lambda (user) + (eq (epg-user-id-validity user) 'revoked)) + (epg-key-user-id-list copy))) + copy) + ;; Nothing to delete; return the key. + key)) + keys)) (defun epg--args-from-sig-notations (notations) (apply #'nconc