termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
12.62k stars 2.91k forks source link

Dialog text entry inconsistent: emacs and gpg on terminal #4545

Open davidpiano opened 4 years ago

davidpiano commented 4 years ago

Problem description I can't be certain where this problem originates, i.e. whether it's a Termux problem, an emacs problem, or a gpg problem. When I try to use (terminal) emacs to open ~/.authinfo.gpg for editing, it's difficult to enter the password that's required for access to that file. It appears that the password dialog box isn't catching all keystrokes, because

EDIT: In trying to test further, I changed a gpg-agent setting that I thought might help by presenting a different dialog. It didn't help, so when the same old dialog appeared in front of emacs, I pressed control-g hoping to cancel it. The actual effect, however, was apparently to send some kind of "suspend" message to the dialog - such that when I quit Emacs and was returned to zsh, the password entry field had "invaded" the terminal emulator itself, causing many keystrokes (but not all!) to appear as * and to cause incorrect output. Seeing that, I used my phone's drop-down notification menu to kill the Termux session. This odd behavior makes me wonder whether the pinentry application is actually at fault.

If I watch carefully to make sure every character of my password DOES produce a * on the password line, repeating each character several times if necessary (sometimes once is enough, sometimes twice or three times; it's unpredictable) to achieve that result, then my password is accepted and the file opens - but after it opens, emacs gives unexpected messages, as if I had entered some invalid emacs commands.

I have tried the same thing using different keyboard apps (Samsung default, Gboard, Hacker's Keyboard, NextApp keyboard) - all have the same effect.

Steps to reproduce

  1. Set up gpg in your Termux system so that gpg is in a working state, and create a file ~/.authinfo.gpg or similar password-protected file
  2. Make sure emacs is installed
  3. emacs -q ~/.authinfo.gpg
  4. Enter your password in the dialog that appears

Expected behavior File should open successfully without incident when the correct password is entered in the dialog box

Additional information

Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.org/packages/ stable main
# science-repo (sources.list.d/science.list)
deb https://dl.bintray.com/grimler/science-packages-24 science stable
# game-repo (sources.list.d/game.list)
deb https://dl.bintray.com/grimler/game-packages-24 games stable
# unstable-repo (sources.list.d/unstable.list)
deb https://dl.bintray.com/xeffyr/unstable-packages unstable main
# x11-repo (sources.list.d/x11.list)
deb https://dl.bintray.com/xeffyr/x11-packages x11 main
# sources.list.d/pointless.list
deb https://its-pointless.github.io/files/24 termux extras
Updatable packages:
All packages up to date
Android version:
9
Kernel build information:
Linux localhost 4.4.111-16467884 termux/termux-app#1 SMP PREEMPT Thu Sep 26 21:31:37 KST 2019 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-A530W
davidpiano commented 4 years ago

A work-around good enough for my personal situation:

Edit .emacs by adding the following: (setq epa-pinentry-mode 'loopback)

Or, for Emacs 27: (setq epg-pinentry-mode 'loopback)

AND

Edit .gnupg/gpg-agent.conf (create it if necessary) by adding the following: allow-emacs-pinentry

Obviously, this avoids the problem rather than fixing it.

stale[bot] commented 2 years ago

This issue/PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.