Subject: bug#40152: 27.0.90; icomplete vs recursive prompts

From: Kévin Le Gouguec <[email-masked]>
Date: Mon, 07 Sep 2020 11:11:27 +0200

Kévin Le Gouguec <[email-masked]> writes:

> (ISTR another instance of this bug where TRAMP and EPG would fight each
> other when using the sudo or sudoedit methods (the former asking for the
> root password, the latter for the ~/.authinfo.gpg key), but I can't seem
> to reproduce it.)

Found a recipe, with the SSH method:

1. create an ~/.authinfo.gpg file with the EasyPG assistant[1]
2. pkill -HUP gpg-agent
2. emacs -Q
3. (progn
     (setq epg-pinentry-mode 'loopback)
     (icomplete-mode))
5. C-x C-f /ssh:

This brings up epa.el's "Passphrase for symmetric encryption" prompt to
unlock ~/.authinfo.gpg.  The prompt cannot be completed, because any
self-inserting character brings the "Find file" prompt back up, and from
*there*, typing any character brings the "Passphrase for symmetric
encryption" prompt back again.

I don't mind icomplete proactively trying to open authinfo.gpg to
find candidates for hostnames[2]; unfortunately as things stand I have
to hit C-g a bunch, disable icomplete, do whatever I was trying to do,
then enable icomplete back.

[1] I.e. visit ~/.authinfo.gpg, and save it with a password when
    prompted.  The content doesn't matter, but it has to be properly
    encrypted, otherwise GPG will recognize the file is malformed and
    abort before EPA can prompt for a password.

[2] Or a TAGS file to find candidates for identifiers, as seen in the
    initial report.