tty_get_ttyname breaks gpg-agent/pinentry?

Werner Koch wk@gnupg.org
Wed Jul 2 20:16:03 2003


On Wed, 2 Jul 2003 11:28:56 -0400, Hank Leininger said:

> Hi,
> It appears that tty_get_ttyname added in 1.2.2 breaks gpg-agent / pinentry
> on Linux 2.4 / glibc 2.2 at least (although if so I'm surprised it hasn't
> been reported already, but I can't see any references on gnupg-users or
> -devel).

If you want to use a curses based pinentry (which is usually also the
fallback mode for a GUI based pinentry), you should add these lines to
your @code{.bashrc} or whatever initialization file is used for all shell
invocations:

@smallexample
GPG_TTY=`tty`
export GPG_TTY
@end smallexample

It is important that this environment variable always reflects the
output of the @code{tty} command.

Did you set it?

> hardcoded '/dev/tty' if it can't call ctermid(3)).  This works fine for gpg
> for normal interactive use I suppose, but kills a previously working gpg +
> gpg-agent + pinentry.

There is no other POSIX comliant solution than the GPG_TTY feature.
Note, that gpg-agent runs in the backround w/o a terminal and thus it
must somehow tell the pinentry where to go.  There is just one
gpg-agent but it must be able to handle requests for gpg[sm]s running
under different ttys.


-- 
Werner Koch                                      <wk@gnupg.org>
The GnuPG Experts                                http://g10code.com
Free Software Foundation Europe	                 http://fsfeurope.org