GNU bug report logs - #79356
31.0.50; 'C-x p r' fails when there are .gpg files EPA can't decrypt

Previous Next

Package: emacs;

Reported by: Sean Whitton <spwhitton <at> spwhitton.name>

Date: Sun, 31 Aug 2025 16:26:02 UTC

Severity: normal

Found in version 31.0.50

Fixed in version 31.1

Done: Sean Whitton <spwhitton <at> spwhitton.name>

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Sean Whitton <spwhitton <at> spwhitton.name>
Subject: bug#79356: closed (Re: bug#79356: 31.0.50; 'C-x p r' fails when
 there are .gpg files EPA can't decrypt)
Date: Tue, 02 Sep 2025 14:45:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#79356: 31.0.50; 'C-x p r' fails when there are .gpg files EPA can't decrypt

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 79356 <at> debbugs.gnu.org.

-- 
79356: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79356
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Sean Whitton <spwhitton <at> spwhitton.name>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 79356-done <at> debbugs.gnu.org
Subject: Re: bug#79356: 31.0.50; 'C-x p r' fails when there are .gpg files
 EPA can't decrypt
Date: Tue, 02 Sep 2025 15:43:46 +0100
Version: 31.1

Hello,

On Tue 02 Sep 2025 at 10:00am -04, Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

> Not sure "<msg>, <new>" is the best syntax (I'd have used "<new>:
> <msg>", instead), but that looks good enough to me, thanks.

I did the colon-separated format first but then I noticed that other
file-errors which were firing were putting it at the end.  I've switched
it back to the colon-separated format for now, anyway, and installed.
Thanks!

-- 
Sean Whitton

[Message part 3 (message/rfc822, inline)]
From: Sean Whitton <spwhitton <at> spwhitton.name>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; 'C-x p r' fails when there are .gpg files EPA can't decrypt
Date: Sun, 31 Aug 2025 17:25:27 +0100
X-debbugs-cc: monnier <at> iro.umontreal.ca

If you try to use 'C-x p r' in emacs.git it exits partway through
because insert-file-contents for etc/package-keyring.gpg cannot succeed.
EPA tries to decrypt the file but can't because it's a keyring.
It even suggests what the problem is:

--8<---------------cut here---------------start------------->8---
Error while decrypting with "/usr/bin/gpg2":

gpg: decrypt_message failed: Unexpected error

(File possibly not an encrypted file, but is perhaps a key ring file?)
--8<---------------cut here---------------end--------------->8---

The problem is a bit more general than just keyrings.  In other
repositories I work with there are encrypted files used as test suite
data.  I don't have the keys in my personal keyring; the keys too are
dummy test suite data, loaded up by the test suite.

In either case the presence of these files shouldn't make it impossible
to use 'C-x p r'.  So how about doing something like this:

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/fileloop.el b/lisp/fileloop.el
index d7d2aa7e0d5..fd749353753 100644
--- a/lisp/fileloop.el
+++ b/lisp/fileloop.el
@@ -121,10 +121,17 @@ fileloop-next-file
         (kill-all-local-variables)
         (erase-buffer)
         (setq new next)
-        (condition-case nil
+        (condition-case err
             (insert-file-contents new nil)
           (file-missing
-           (fileloop-next-file novisit))))
+           (fileloop-next-file novisit))
+          (file-error
+           (unless
+               (and (equal (caddr err) "Can't decrypt")
+                    (y-or-n-p (substitute-quotes
+                               (format "Couldn't decrypt `%s'; skip it?"
+                                       (abbreviate-file-name new)))))
+             (signal (car err) (cdr err))))))
       new)))
 
 (defun fileloop-continue ()
--8<---------------cut here---------------end--------------->8---

-- 
Sean Whitton



This bug report was last modified 4 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.