I apologize in advance that this bug report is so scatter-brained. Googling has shown that not many people have complained about this issue, but that it has gone on in various forms for about two years. It requires a fairly complicated set of conditions, but for those (few) of us who want to manage encryption with gpg-agent and love mutt, it seems killer. Since the gentoo community encourages the use of keychain and mutt, I thought I'd ask for help here before moving upstream. PROBLEM: After using pinentry-curses to enter gpg-agent passphrase in mutt, the interface to mutt get's hosed. For instance, after pineentry-curses successfully runs, mutt doesn't know what the UP and DOWN keys do; it returns only "Key is not bound. Press '?' for help." REPRODUCE: 1) emerge mutt with gpgme support, and emerge latest versions of gpgme, gpg-agent, and pinetry. 2) put "pinentry /usr/bin/pinentry-curses" in ~/.gnupg/gpg-agent.conf so that the X passphrase interface is not used. 3) start a gpg-agent --daemon. 4) make sure the GPG_TTY variable is set to $(tty), and run mutt. Try to open an encrypted mail or sign a mail. pinentry-curses comes up, the passphrase is requested, then mutt returns RESULT: There may or may not be curses screen artifacts, and UP/DOWN keys fail to work in mutt. COMMENTS: This year-old thread claims it's fixed, but things have changed since then with gpgme: http://www.intevation.de/roundup/aegypten/issue277 I tried to apply the same idea by adding keypad (stdscr, TRUE); clearok (stdscr, TRUE); to lines 3695-6 of crypt-gpgme.c, but it didn't work. Another note: If this mutt is in the same screen session as a vim, the vim appears to get hosed in the same way (arrow keys die), but running pinsentry-curses directly from gpg (NOT from within mutt) along side a vim in screen, vim is not hosed.
The patch mentioned in the thread has never been integrated by upstream into mutt.
Okay, I just tried their patch by hand in mutt-1.5.11, by just commenting out the "if" and the brackets. It appears to work for mutt on its own: Line 71 of curs_lib.c // if (!getenv ("DISPLAY")) // { keypad (stdscr, TRUE); clearok (stdscr, TRUE); set_option (OPTNEEDREDRAW); // } However, this problem still occurs within GNU/screen. Any thoughts on how to patch it there? I guess the best solution is to track down the problem in pinentry itself instead of every program it shares a terminal with...
Not really sure this is a vim-specific problem. Feel free to re-add us to the CC if it ends up seeming that way.
I don't have time to look into this at present, but an ugly workaround when in GNU screen is to just pretend you're not. e.g. in my .bashrc I have the following line: alias mutt="TERM=rxvt-unicode; mutt"
Hi, Please take this to upstream. It is not Gentoo specific issue. Thanks.