From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Jul 30 06:20:05 2012 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28511106564A for ; Mon, 30 Jul 2012 06:20:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id EE94E8FC0C for ; Mon, 30 Jul 2012 06:20:04 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q6U6K4YX045765 for ; Mon, 30 Jul 2012 06:20:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q6U6K4kQ045764; Mon, 30 Jul 2012 06:20:04 GMT (envelope-from gnats) Resent-Date: Mon, 30 Jul 2012 06:20:04 GMT Resent-Message-Id: <201207300620.q6U6K4kQ045764@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Ben Cottrell Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DAC09106564A for ; Mon, 30 Jul 2012 06:15:22 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 7AA038FC08 for ; Mon, 30 Jul 2012 06:15:22 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q6U6FM2t007646 for ; Mon, 30 Jul 2012 06:15:22 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q6U6FMBC007636; Mon, 30 Jul 2012 06:15:22 GMT (envelope-from nobody) Message-Id: <201207300615.q6U6FMBC007636@red.freebsd.org> Date: Mon, 30 Jul 2012 06:15:22 GMT From: Ben Cottrell To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/170269: Fix /dev/tty brokenness in ports/security/gnupg [PATCH] X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jul 2012 06:20:05 -0000 >Number: 170269 >Category: ports >Synopsis: Fix /dev/tty brokenness in ports/security/gnupg [PATCH] >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Jul 30 06:20:04 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Ben Cottrell >Release: 9.0-RELEASE >Organization: >Environment: FreeBSD pendor.wolfhut.org 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #0: Tue Jun 12 02:52:29 UTC 2012 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64 >Description: Note: This patch is NOT to be applied to the FreeBSD source tree or the ports tree with patch(1). It is a patch *file*, to be added as-is to the ports tree, with a suggested filename of "ports/security/gnupg/files/patch-dev-tty". If you give gpg some input on standard input, and it needs to prompt you to enter your passphrase, it doesn't realize that it has to reopen /dev/tty. There are three places in the source where they try to figure out what the tty is, and *one* of them was correct. This patch just makes the other two correct, as well. I also submitted this to the gnupg folks (https://bugs.g10code.com/gnupg/issue1434). But all else being equal, I'd rather see this show up in portsnap sooner rather than later! This bug basically prevents me from using gpg2, and I have to use gpg1 instead. >How-To-Repeat: # Force it to use the ncurses pinentry method unsetenv DISPLAY # Of course it'll work if you have $GPG_TTY set. This patch makes it work # even if you do *not* have $GPG_TTY set. To reproduce, you must unset it. unsetenv GPG_TTY # Try to sign something, passing the data in as standard input. touch a_file gpg -a --clearsign < a_file > out_file >Fix: Patch attached with submission follows: diff -ur common/session-env.c.orig common/session-env.c --- common/session-env.c.orig 2012-03-27 01:00:37.000000000 -0700 +++ common/session-env.c 2012-07-29 18:35:08.000000000 -0700 @@ -328,8 +328,12 @@ /* Get the default value with and additional fallback for GPG_TTY. */ defvalue = getenv (name); - if ((!defvalue || !*defvalue) && !strcmp (name, "GPG_TTY") && ttyname (0)) - defvalue = ttyname (0); + if ((!defvalue || !*defvalue) && !strcmp (name, "GPG_TTY")) + { + defvalue = ttyname (0); + if (!defvalue) + defvalue = "/dev/tty"; + } if (defvalue) { /* Record the default value for later use so that we are safe diff -ur common/simple-pwquery.c.orig common/simple-pwquery.c --- common/simple-pwquery.c.orig 2012-03-27 01:00:37.000000000 -0700 +++ common/simple-pwquery.c 2012-07-29 18:37:38.000000000 -0700 @@ -224,7 +224,11 @@ dft_ttyname = getenv ("GPG_TTY"); #ifndef HAVE_W32_SYSTEM if ((!dft_ttyname || !*dft_ttyname) && ttyname (0)) - dft_ttyname = ttyname (0); + { + dft_ttyname = ttyname (0); + if (!dft_ttyname) + dft_ttyname = "/dev/tty"; + } #endif if (dft_ttyname && *dft_ttyname) { >Release-Note: >Audit-Trail: >Unformatted: