#657093 gnupg-agent: pinentry program shouldn't be told to use Emacs' TTY

#657093#5
Date:
2012-01-23 23:11:08 UTC
From:
To:
(This bug should perhaps be filed against both gnupg and gnupg2, but
debbug doesn't really have a clean way to do this, so...)

I expect you're aware that when gpg or gpg2 is invoked under Emacs, the
DISPLAY environment variable is unset, and gpg-agent needs to prompt for
a passphrase, the pinentry program makes a mess on the terminal.

It might not be fair to blame this on pinentry or gpg-agent, though
gpg-agent could perhaps discard any "ttyname" values accompanied by a
"ttytype" of "dumb", if the following excerpt from an strace of
gpg-connect-agent run using Emacs' `shell-command' is any indication:

,----
| socket(PF_FILE, SOCK_STREAM, 0)         = 4
| connect(4, {sa_family=AF_FILE, path="/home/naesten/.gnupg/S.gpg-agent"}, 34) = 0
| read(4, "OK Pleased to meet you, process "..., 1002) = 38
| write(4, "RESET", 5)                    = 5
| write(4, "\n", 1)                       = 1
| read(4, "OK\n", 1002)                   = 3
| write(4, "OPTION ttyname=/dev/pts/38", 26) = 26
| write(4, "\n", 1)                       = 1
| read(4, "OK\n", 1002)                   = 3
| write(4, "OPTION ttytype=dumb", 19)     = 19
| write(4, "\n", 1)                       = 1
| read(4, "OK\n", 1002)                   = 3
| write(4, "OPTION lc-ctype=en_US.UTF-8", 27) = 27
| write(4, "\n", 1)                       = 1
| read(4, "OK\n", 1002)                   = 3
| write(4, "OPTION lc-messages=en_US.UTF-8", 30) = 30
| write(4, "\n", 1)                       = 1
| read(4, "OK\n", 1002)                   = 3
`----

Alternatively, gnupg/gnupg2/et al could refrain from sending the tty at
all in such cases. I believe most of these programs use a library to
communicate with gpg-agent; perhaps the logic could be added there?

#657093#10
Date:
2015-01-04 23:30:02 UTC
From:
To:
* Samuel Bronson (naesten@gmail.com) wrote:

You're aware you can redirect which tty gets used with GPG_TTY?

This sounds like a bug in pinentry, in that it can't handle dumb
consoles gracefully. Is that a fair characterization?