BUG: gpg(2)/pinentry-curses interaction faulty

Werner Koch wk at gnupg.org
Mon Oct 25 10:40:32 CEST 2004


On Sun, 24 Oct 2004 16:49:28 +0000, Albrecht Dreß said:

> The workaround for this problem is adding something like GPG_TTY=$(tty) to  
> e.g. .bashrc, but of course it would be better if gpg(2) like gpgsm would  
> set ttyname correctly.

They only try to set the tty correctly but they won't be able to do
this reliable.  As stated in the manual, setting GPG_TTY before
running a program using gpg or gpgsm is the only way to go.  The
problem is that ttyname(3) needs a file descriptor connected to the
TTY - this is not always the case.  It is also not possible to use
/dev/tty because the pinentry is called from a process without a
controlling terminal.

getenv("GPG_TTY") must always return a filename which can be opened as
a terminal.  That is, it shall return what you expect tty(1) to return
- even if there is no associated tty.  Remember that we are writing to
a tty from an unrelated background process.


Shalom-Salam,

   Werner





More information about the Gnupg-devel mailing list