Subject: bug#3829: 23.0.96; Cannot read gpg file

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 30 Aug 2019 13:19:57 +0200

Андрей Парамонов <[email-masked]> writes:

> To reproduce:
>
> 0) emacs -Q
>
> 1) C-x C-f attached file
>
> 2) Emacs says:
> File exists, but cannot be read

(The user included a trusted.gpg file; which is a key ring.)

The problem here is that there are two common uses of the .gpg suffix.

Emacs assumes that all files that end with .gpg are encrypted files, and
will error out dramatically when trying to read those files.  The only
way the user has to look at them is with `M-x find-file-literally'.

But .gpg is also a common suffix for key ring files.

Emacs could be more helpful here and check the first few bytes of the
file to see what type it is.

https://lists.gnupg.org/pipermail/gnupg-users/2013-September/047725.html

But that doesn't seem to be totally trivial.

Should Emacs treat these as normal files if gpg gives an error message
when trying to open them?

---
Error while decrypting with "/usr/bin/gpg2":

gpg: decrypt_message failed: Unexpected error
---

That doesn't seem very logical, either...

Anybody got any ideas?

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