Page MenuHome GnuPG

pinentry-curses broken when launched from tig that's launched from mc
Open, NormalPublic

Description

I'm using fish-shell and because Midnight Commander doesn't cope that well with it, I set my SHELL variable to bash so mc creates a bash subshell. So far, so good.

Now when running tig (ncurses git frontend) from within mc and creating a new commit, neovim (my configured editor) pops up and lets me enter the commit message. After storing that and closing nvim, pinentry-curses pops up and wants my passphrase. However, every second or third character is shown as plaintext and even when entering the correct passphrase, it isn't accepted. (On a sidenode: Ctrl-C'ing out of pinentry isn't possible at this point. Also the "Cancel" button only works sometimes.)

Now if I close mc and run tig directly from the (fish-)shell, everything works as expected - pinentry shows only asterisks and happily accepts my passphrase.

This is on Ubuntu 17.10 with pinentry-curses 1.0.0-2.

Event Timeline

When a command is invoked from Midnight Commander, pseudo tty is used.
You can confirm that by typing tty and see the output of the command after exiting from mc and again typing tty.

The particular problem is that, gpg-agent should open pinentry with the TTY under MC, but apparently, it does with original TTY which is under control of MC.
Thus, the I/O of TTY is done for both of pinentry and MC.

I think that this could be solved by defining GPG_TTY environment variable in ~/.local/share/mc/bashrc like:

GPG_TTY=$(tty)
export GPG_TTY

Please try. I don't use MC at all, so, I may be completely wrong.

gniibe triaged this task as Normal priority.
gniibe added a project: Documentation.