Page MenuHome GnuPG

gpg erroring when the terminal is too small to show the ncurses pinentry dialog
Closed, ResolvedPublic


I haven't found this report yet by searching in this site for pinentry ncurses and pinetry ncurses size.

When I ask pass for a password, e.g. via pass -c path/to/password, it invokes gpg to decript a file from the password store, so gpg asks for the passphrase of the associated key. If one selects the <cancel> button and presses enter, he gets the error gpg: decryption failed: No secret key. This is imho a bit strange, but ok.

However, and here lies a bug (or at least a perceived bug), if the terminal window is too small, that error is displayed directly, without even opening the ncurses dialog box.

For a screencast of the strange behavior, please refer to my question here.

Event Timeline

werner triaged this task as Normal priority.Feb 23 2021, 5:02 PM
werner added a subscriber: werner.

Thanks for the report. Frankly the curses pinentries are not that widely tested.

As suggested in the linked question on stackexchange, I think that even if the error comes from the pinentry program, GnuPG could echo a more informative error than gpg: decryption failed: No secret key, such as terminal to little to show the pinetnry program, or something similar.

That might depend on your pinentry version. With a pre-1.1.1 pinentry and 2.2.28 I get this:

gpg: pinentry launched (3350 gtk2:curses 1.1.1-beta41 /dev/pts/5 xterm - [...]
gpg: signing failed: Screen or window too small

I also get

gpg: signing failed: Operation cancelled

when I select the cancel (curses-)button. The curses-pinentry uses the same code as the gtk pinnetry in curses mode. You may want to run gpg with -v to see the "pinentry launched" line.

werner claimed this task.