Bug 170269 - Fix /dev/tty brokenness in ports/security/gnupg [PATCH]
Fix /dev/tty brokenness in ports/security/gnupg [PATCH]
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: Jun Kuriyama
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-30 07:20 UTC by tamino
Modified: 2012-08-05 10:50 UTC (History)
0 users

See Also:


Attachments
file.diff (1.17 KB, patch)
2012-07-30 07:20 UTC, tamino
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tamino 2012-07-30 07:20:04 UTC
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.

Fix: Patch attached with submission follows:
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
Comment 1 Edwin Groothuis freebsd_committer 2012-07-30 07:20:17 UTC
Responsible Changed
From-To: freebsd-ports-bugs->kuriyama

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter freebsd_committer 2012-08-05 10:42:14 UTC
Author: kuriyama
Date: Sun Aug  5 09:41:57 2012
New Revision: 302102
URL: http://svn.freebsd.org/changeset/ports/302102

Log:
  - Convert to OptionsNG.
  - Don't install gpg-zip.1 manpage as gpg-zip script is not installed
    [1].
  - Fix /dev/tty brokenness [2].
  
  PR:		ports/170327 [1], ports/170269 [2]
  Submitted by:	Alfred Bartsch <bartsch@dssgmbh.de> [1],
  	  	Ben Cottrell <tamino@wolfhut.org> [2]

Added:
  head/security/gnupg/files/
  head/security/gnupg/files/patch-dev-tty   (contents, props changed)
  head/security/gnupg/files/patch-doc-Makefile.in   (contents, props changed)
Modified:
  head/security/gnupg/Makefile
  head/security/gnupg/pkg-plist

Modified: head/security/gnupg/Makefile
==============================================================================
--- head/security/gnupg/Makefile	Sun Aug  5 08:42:59 2012	(r302101)
+++ head/security/gnupg/Makefile	Sun Aug  5 09:41:57 2012	(r302102)
@@ -7,6 +7,7 @@
 
 PORTNAME=	gnupg
 PORTVERSION=	2.0.19
+PORTREVISION=	1
 CATEGORIES=	security
 MASTER_SITES=	${MASTER_SITE_GNUPG}
 MASTER_SITE_SUBDIR=	gnupg
@@ -16,16 +17,17 @@ EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}
 MAINTAINER=	kuriyama@FreeBSD.org
 COMMENT=	The GNU Privacy Guard
 
-LIB_DEPENDS=	assuan.0:${PORTSDIR}/security/libassuan \
-		gcrypt.18:${PORTSDIR}/security/libgcrypt \
-		gpg-error:${PORTSDIR}/security/libgpg-error \
-		ksba.19:${PORTSDIR}/security/libksba \
-		pth.20:${PORTSDIR}/devel/pth
-
 LICENSE=	GPLv3 LGPL3
 LICENSE_COMB=	multi
 LICENSE_FILE_GPLv3=	${WRKSRC}/COPYING
 LICENSE_FILE_LGPL3=	${WRKSRC}/COPYING.LIB
+
+LIB_DEPENDS=	assuan:${PORTSDIR}/security/libassuan \
+		gcrypt:${PORTSDIR}/security/libgcrypt \
+		gpg-error:${PORTSDIR}/security/libgpg-error \
+		ksba:${PORTSDIR}/security/libksba \
+		pth:${PORTSDIR}/devel/pth
+
 USE_BZIP2=	YES
 USE_GMAKE=	YES
 GNU_CONFIGURE=	YES
@@ -37,37 +39,38 @@ CONFIGURE_ARGS+=	--disable-doc
 .else
 MAN1=		gpg2.1 gpgsm.1 gpgv2.1 gpg-agent.1 scdaemon.1 watchgnupg.1 \
 		gpgconf.1 gpg-preset-passphrase.1 gpg-connect-agent.1 \
-		gpgparsemail.1 symcryptrun.1 gpgsm-gencert.sh.1 gpg-zip.1
+		gpgparsemail.1 symcryptrun.1 gpgsm-gencert.sh.1
 MAN8=		addgnupghome.8 applygnupgdefaults.8
 INFO=		gnupg
 .endif
 
-OPTIONS=	PINENTRY "Use pinentry" off \
-		LDAP "LDAP keyserver interface" off \
-		SCDAEMON "Enable Smartcard daemon (with libusb)" off \
-		CURL "Use the real curl library (worked around if no)" on \
-		GPGSM "Enable GPGSM (requires LDAP)" off \
-		KDNS "Use DNS CERT helper" off \
-		STD_SOCKET "Use standard socket for agent" off \
-		NLS "National Language Support" off
+OPTIONS_DEFINE=		PINENTRY LDAP SCDAEMON CURL GPGSM KDNS STD_SOCKET NLS
+PINENTRY_DESC=		Use pinentry
+LDAP_DESC=		LDAP keyserver interface
+SCDAEMON_DESC=		Enable Smartcard daemon (with libusb)
+CURL_DESC=		Use the real curl library (worked around if no)
+GPGSM_DESC=		Enable GPGSM (requires LDAP)
+KDNS_DESC=		Use DNS CERT helper
+STD_SOCKET_DESC=	Use standard socket for agent
+OPTIONS_DEFAULT=	CURL
+NO_OPTIONS_SORT=	YES
 
-.include <bsd.port.pre.mk>
+.include <bsd.port.options.mk>
 
-.if defined(WITH_PINENTRY)
+.if ${PORT_OPTIONS:MPINENTRY}
 RUN_DEPENDS+=	pinentry>0:${PORTSDIR}/security/pinentry
 .endif
 
-.if defined(WITHOUT_GPGSM)
-CONFIGURE_ARGS+=--disable-gpgsm
-PLIST_SUB+=	GPGSM="@comment "
-.else
+.if ${PORT_OPTIONS:MGPGSM}
 RUN_DEPENDS+=	dirmngr:${PORTSDIR}/security/dirmngr
-WITH_LDAP=	YES
-.undef WITHOUT_LDAP
+PORT_OPTIONS+=	LDAP
 PLIST_SUB+=	GPGSM=""
+.else
+CONFIGURE_ARGS+=--disable-gpgsm
+PLIST_SUB+=	GPGSM="@comment "
 .endif
 
-.if defined(WITH_LDAP)
+.if ${PORT_OPTIONS:MLDAP}
 USE_OPENLDAP=	YES
 CONFIGURE_ARGS+=--with-ldap=${LOCALBASE}
 PLIST_SUB+=	LDAP=""
@@ -76,7 +79,7 @@ CONFIGURE_ARGS+=--disable-ldap
 PLIST_SUB+=	LDAP="@comment "
 .endif
 
-.if defined(WITH_KDNS) && !defined(WITHOUT_KDNS)
+.if ${PORT_OPTIONS:MKDNS}
 LIB_DEPENDS+=	adns:${PORTSDIR}/dns/adns
 PLIST_SUB+=	ADNS=""
 .else
@@ -84,11 +87,11 @@ CONFIGURE_SUB=	-e '/GPGKEYS_KDNS=/s/".*"
 PLIST_SUB+=	ADNS="@comment "
 .endif
 
-.if defined(WITH_STD_SOCKET) && !defined(WITHOUT_STD_SOCKET)
+.if ${PORT_OPTIONS:MSTD_SOCKET}
 CONFIGURE_ARGS+=--enable-standard-socket
 .endif
 
-.if defined(WITH_NLS) && !defined(WITHOUT_NLS)
+.if ${PORT_OPTIONS:MNLS}
 USE_GETTEXT=	YES
 CONFIGURE_ARGS+=--enable-nls
 PLIST_SUB+=	NLS=""
@@ -97,7 +100,7 @@ CONFIGURE_ARGS+=--disable-nls
 PLIST_SUB+=	NLS="@comment "
 .endif
 
-.if defined(WITH_SCDAEMON)
+.if ${PORT_OPTIONS:MSCDAEMON}
 CONFIGURE_ARGS+=--enable-scdaemon
 . if ${OSVERSION} < 800069
 LIB_DEPENDS+=	usb-0.1:${PORTSDIR}/devel/libusb
@@ -108,7 +111,7 @@ CONFIGURE_ARGS+=--disable-scdaemon
 PLIST_SUB+=	SCDAEMON="@comment "
 .endif
 
-.if defined(WITHOUT_CURL)
+.if ${PORT_OPTIONS:MCURL}
 CONFIGURE_ARGS+=--without-libcurl
 .else
 LIB_DEPENDS+=	curl:${PORTSDIR}/ftp/curl
@@ -131,4 +134,4 @@ post-install:
 .endif
 	@${CAT} ${PKGMESSAGE}
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>

Added: head/security/gnupg/files/patch-dev-tty
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/security/gnupg/files/patch-dev-tty	Sun Aug  5 09:41:57 2012	(r302102)
@@ -0,0 +1,36 @@
+$FreeBSD$
+
+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)
+     {

Added: head/security/gnupg/files/patch-doc-Makefile.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/security/gnupg/files/patch-doc-Makefile.in	Sun Aug  5 09:41:57 2012	(r302102)
@@ -0,0 +1,13 @@
+$FreeBSD$
+
+--- doc/Makefile.in	2012-08-05 12:21:36.163578307 +0900
++++ doc/Makefile.in.orig	2012-08-05 12:21:25.241287984 +0900
+@@ -367,7 +367,7 @@
+ myman_pages = gpg2.1 gpgsm.1 gpg-agent.1 scdaemon.1 gpgv2.1 \
+                 watchgnupg.1 gpgconf.1 addgnupghome.8 gpg-preset-passphrase.1 \
+ 		gpg-connect-agent.1 gpgparsemail.1 symcryptrun.1 \
+-		gpgsm-gencert.sh.1 applygnupgdefaults.8 gpg-zip.1
++		gpgsm-gencert.sh.1 applygnupgdefaults.8
+ 
+ man_MANS = $(myman_pages)
+ noinst_MANS = gnupg.7

Modified: head/security/gnupg/pkg-plist
==============================================================================
--- head/security/gnupg/pkg-plist	Sun Aug  5 08:42:59 2012	(r302101)
+++ head/security/gnupg/pkg-plist	Sun Aug  5 09:41:57 2012	(r302102)
@@ -34,37 +34,37 @@ sbin/applygnupgdefaults
 %%PORTDOCS%%%%DOCSDIR%%/examples/pwpattern.list
 %%PORTDOCS%%%%DOCSDIR%%/examples/scd-event
 %%PORTDOCS%%%%DOCSDIR%%/examples/trustlist.txt
-%%PORTDOCS%%%%DATADIR%%/com-certs.pem
+%%PORTDATA%%%%DATADIR%%/com-certs.pem
 %%DATADIR%%/gpg-conf.skel
-%%PORTDOCS%%%%DATADIR%%/help.be.txt
-%%PORTDOCS%%%%DATADIR%%/help.ca.txt
-%%PORTDOCS%%%%DATADIR%%/help.cs.txt
-%%PORTDOCS%%%%DATADIR%%/help.da.txt
-%%PORTDOCS%%%%DATADIR%%/help.de.txt
-%%PORTDOCS%%%%DATADIR%%/help.el.txt
-%%PORTDOCS%%%%DATADIR%%/help.eo.txt
-%%PORTDOCS%%%%DATADIR%%/help.es.txt
-%%PORTDOCS%%%%DATADIR%%/help.et.txt
-%%PORTDOCS%%%%DATADIR%%/help.fi.txt
-%%PORTDOCS%%%%DATADIR%%/help.fr.txt
-%%PORTDOCS%%%%DATADIR%%/help.gl.txt
-%%PORTDOCS%%%%DATADIR%%/help.hu.txt
-%%PORTDOCS%%%%DATADIR%%/help.id.txt
-%%PORTDOCS%%%%DATADIR%%/help.it.txt
-%%PORTDOCS%%%%DATADIR%%/help.ja.txt
-%%PORTDOCS%%%%DATADIR%%/help.nb.txt
-%%PORTDOCS%%%%DATADIR%%/help.pl.txt
-%%PORTDOCS%%%%DATADIR%%/help.pt.txt
-%%PORTDOCS%%%%DATADIR%%/help.pt_BR.txt
-%%PORTDOCS%%%%DATADIR%%/help.ro.txt
-%%PORTDOCS%%%%DATADIR%%/help.ru.txt
-%%PORTDOCS%%%%DATADIR%%/help.sk.txt
-%%PORTDOCS%%%%DATADIR%%/help.sv.txt
-%%PORTDOCS%%%%DATADIR%%/help.tr.txt
-%%PORTDOCS%%%%DATADIR%%/help.txt
-%%PORTDOCS%%%%DATADIR%%/help.zh_CN.txt
-%%PORTDOCS%%%%DATADIR%%/help.zh_TW.txt
-%%PORTDOCS%%%%DATADIR%%/qualified.txt
+%%PORTDATA%%%%DATADIR%%/help.be.txt
+%%PORTDATA%%%%DATADIR%%/help.ca.txt
+%%PORTDATA%%%%DATADIR%%/help.cs.txt
+%%PORTDATA%%%%DATADIR%%/help.da.txt
+%%PORTDATA%%%%DATADIR%%/help.de.txt
+%%PORTDATA%%%%DATADIR%%/help.el.txt
+%%PORTDATA%%%%DATADIR%%/help.eo.txt
+%%PORTDATA%%%%DATADIR%%/help.es.txt
+%%PORTDATA%%%%DATADIR%%/help.et.txt
+%%PORTDATA%%%%DATADIR%%/help.fi.txt
+%%PORTDATA%%%%DATADIR%%/help.fr.txt
+%%PORTDATA%%%%DATADIR%%/help.gl.txt
+%%PORTDATA%%%%DATADIR%%/help.hu.txt
+%%PORTDATA%%%%DATADIR%%/help.id.txt
+%%PORTDATA%%%%DATADIR%%/help.it.txt
+%%PORTDATA%%%%DATADIR%%/help.ja.txt
+%%PORTDATA%%%%DATADIR%%/help.nb.txt
+%%PORTDATA%%%%DATADIR%%/help.pl.txt
+%%PORTDATA%%%%DATADIR%%/help.pt.txt
+%%PORTDATA%%%%DATADIR%%/help.pt_BR.txt
+%%PORTDATA%%%%DATADIR%%/help.ro.txt
+%%PORTDATA%%%%DATADIR%%/help.ru.txt
+%%PORTDATA%%%%DATADIR%%/help.sk.txt
+%%PORTDATA%%%%DATADIR%%/help.sv.txt
+%%PORTDATA%%%%DATADIR%%/help.tr.txt
+%%PORTDATA%%%%DATADIR%%/help.txt
+%%PORTDATA%%%%DATADIR%%/help.zh_CN.txt
+%%PORTDATA%%%%DATADIR%%/help.zh_TW.txt
+%%PORTDATA%%%%DATADIR%%/qualified.txt
 %%NLS%%share/locale/be/LC_MESSAGES/gnupg2.mo
 %%NLS%%share/locale/ca/LC_MESSAGES/gnupg2.mo
 %%NLS%%share/locale/cs/LC_MESSAGES/gnupg2.mo
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Jun Kuriyama freebsd_committer 2012-08-05 10:42:34 UTC
State Changed
From-To: open->closed

Committed, thanks!