Page MenuHome GnuPG

tty_get_ttyname added in 1.2.2 breaks gpg-agent/pinentry
Closed, ResolvedPublic

Description

Release: 1.2.2

Environment

Linux 2.4.x, glibc 2.2.x

Description

utils/ttyio.c:tty_get_ttyname, added in 1.2.2, calls ctermid(3), which always returns /dev/tty (on Linux at least).
This doesn't bother gpg, but it breaks gpg-agent+pinentry, as the latter tries to open whatever ttyname is passed to it.
Previous gpg versions used simply ttyname(3), which returned proper /dev/pts/XX, and all was right with the world.

I just mailed gnupg-users about this (Subject: tty_get_ttyname breaks gpg-agent/pinentry?), before realizing bugs.gnupg.org was the right place :-P

How To Repeat

Just try to run gpg-agent and pinentry (curses) with gnupg 1.2.2:

$ gpg -a -o foo.asc -se foo

You need a passphrase to unlock the secret key for
user: "Hank Leininger <hlein@progressive-comp.com>"
1024-bit DSA key, ID 861AA6F1, created 2001-07-09

gpg: cancelled by user
gpg: no default secret key: bad passphrase
gpg: foo: sign+encrypt failed: bad passphrase

(I touched nothing after the initial Return.)

Fix

Possibly fix tty_get_ttyname to use ttyname instead of ctermid, although presumably it was added for a reason...
+++
ctermid is used for POSIX comliance. The real soultion is to set GPG_TTY. There is no other way of doing so.

Event Timeline

werner added a subscriber: werner.

use GPG_TTY

werner removed a project: Restricted Project.May 1 2004, 1:55 PM

No feedback received, thus closing