Wed Oct 29 20:11:31 2014 UTC ()
Pullup ticket #4531 - requested by he
security/libgpg-error: bug fix patch

Revisions pulled up:
- security/libgpg-error/Makefile                                1.44 via patch
- security/libgpg-error/distinfo                                1.21 via patch
- security/libgpg-error/patches/patch-src_estream.c             1.1

---
   Module Name:	pkgsrc
   Committed By:	he
   Date:		Wed Oct 29 12:28:50 UTC 2014

   Modified Files:
   	pkgsrc/security/libgpg-error: Makefile distinfo
   Added Files:
   	pkgsrc/security/libgpg-error/patches: patch-src_estream.c

   Log Message:
   Use __attribute__((destructor)) instead of atexit(), so that the
   library wind-down function is both called on dlclose() and exit().
   Should avoid segfault when trying to call the atexit function after
   dlclose() which unmaps the library.  Fixes PR pkg/49333, thanks to
   joerg@ for the suggested fix.

   Also, the IRIX and NetBSD tool name to get at nawk is just "awk",
   flagged by pkglint.

   Bump PKGREVISION.


(tron)
diff -r1.40 -r1.40.2.1 pkgsrc/security/libgpg-error/Makefile
diff -r1.18 -r1.18.2.1 pkgsrc/security/libgpg-error/distinfo
diff -r0 -r1.1.2.2 pkgsrc/security/libgpg-error/patches/patch-src_estream.c

cvs diff -r1.40 -r1.40.2.1 pkgsrc/security/libgpg-error/Makefile (expand / switch to unified diff)

--- pkgsrc/security/libgpg-error/Makefile 2014/09/14 16:45:54 1.40
+++ pkgsrc/security/libgpg-error/Makefile 2014/10/29 20:11:31 1.40.2.1
@@ -1,16 +1,17 @@ @@ -1,16 +1,17 @@
1# $NetBSD: Makefile,v 1.40 2014/09/14 16:45:54 wiz Exp $ 1# $NetBSD: Makefile,v 1.40.2.1 2014/10/29 20:11:31 tron Exp $
2 2
3DISTNAME= libgpg-error-1.15 3DISTNAME= libgpg-error-1.15
 4PKGREVISION= 1
4CATEGORIES= security 5CATEGORIES= security
5MASTER_SITES= ftp://ftp.gnupg.org/gcrypt/libgpg-error/ \ 6MASTER_SITES= ftp://ftp.gnupg.org/gcrypt/libgpg-error/ \
6 ftp://ftp.ring.gr.jp/pub/net/gnupg/libgpg-error/ \ 7 ftp://ftp.ring.gr.jp/pub/net/gnupg/libgpg-error/ \
7 ftp://mirror.switch.ch/mirror/gnupg/libgpg-error/ \ 8 ftp://mirror.switch.ch/mirror/gnupg/libgpg-error/ \
8 ftp://ftp.freenet.de/pub/ftp.gnupg.org/gcrypt/libgpg-error/ \ 9 ftp://ftp.freenet.de/pub/ftp.gnupg.org/gcrypt/libgpg-error/ \
9 ftp://ftp.gnupg.ca/libgpg-error/ 10 ftp://ftp.gnupg.ca/libgpg-error/
10EXTRACT_SUFX= .tar.bz2 11EXTRACT_SUFX= .tar.bz2
11 12
12MAINTAINER= minskim@NetBSD.org 13MAINTAINER= minskim@NetBSD.org
13HOMEPAGE= http://www.gnupg.org/ 14HOMEPAGE= http://www.gnupg.org/
14COMMENT= Definitions of common error values for all GnuPG components 15COMMENT= Definitions of common error values for all GnuPG components
15LICENSE= gnu-gpl-v2 AND gnu-lgpl-v2.1 16LICENSE= gnu-gpl-v2 AND gnu-lgpl-v2.1
16 17
@@ -23,27 +24,27 @@ GNU_CONFIGURE= yes @@ -23,27 +24,27 @@ GNU_CONFIGURE= yes
23MAKE_ENV+= LC_ALL="C" 24MAKE_ENV+= LC_ALL="C"
24MAKE_JOBS_SAFE= no 25MAKE_JOBS_SAFE= no
25 26
26.include "../../mk/bsd.prefs.mk" 27.include "../../mk/bsd.prefs.mk"
27 28
28.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) 29.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
29CONFIGURE_ENV+= CC_FOR_BUILD=${NATIVE_CC:Q} 30CONFIGURE_ENV+= CC_FOR_BUILD=${NATIVE_CC:Q}
30.else 31.else
31CONFIGURE_ENV+= CC_FOR_BUILD=${CC:Q}\ ${CFLAGS:M*:Q} 32CONFIGURE_ENV+= CC_FOR_BUILD=${CC:Q}\ ${CFLAGS:M*:Q}
32.endif 33.endif
33 34
34# XXX See HACKS 35# XXX See HACKS
35.if ${OPSYS} == "IRIX" || !empty(MACHINE_PLATFORM:MNetBSD-[3-9]*) 36.if ${OPSYS} == "IRIX" || !empty(MACHINE_PLATFORM:MNetBSD-[3-9]*)
36USE_TOOLS+= nawk 37USE_TOOLS+= awk
37.else 38.else
38USE_TOOLS+= gawk 39USE_TOOLS+= gawk
39.endif 40.endif
40 41
41# On Dragonfly i386, Pkgsrc libintl segfaults on bindtextdomain function 42# On Dragonfly i386, Pkgsrc libintl segfaults on bindtextdomain function
42# while locking a thread. Until that's resolved, stop libgpg-error from 43# while locking a thread. Until that's resolved, stop libgpg-error from
43# using NLS which invokes that function during initialization. 44# using NLS which invokes that function during initialization.
44PLIST_VARS+= nls 45PLIST_VARS+= nls
45.if ${OPSYS} == "DragonFly" && ${MACHINE} == "i386" 46.if ${OPSYS} == "DragonFly" && ${MACHINE} == "i386"
46CONFIGURE_ARGS+= --disable-nls 47CONFIGURE_ARGS+= --disable-nls
47.else 48.else
48PLIST.nls= yes 49PLIST.nls= yes
49.endif 50.endif

cvs diff -r1.18 -r1.18.2.1 pkgsrc/security/libgpg-error/distinfo (expand / switch to unified diff)

--- pkgsrc/security/libgpg-error/distinfo 2014/09/16 23:17:48 1.18
+++ pkgsrc/security/libgpg-error/distinfo 2014/10/29 20:11:31 1.18.2.1
@@ -1,7 +1,8 @@ @@ -1,7 +1,8 @@
1$NetBSD: distinfo,v 1.18 2014/09/16 23:17:48 tron Exp $ 1$NetBSD: distinfo,v 1.18.2.1 2014/10/29 20:11:31 tron Exp $
2 2
3SHA1 (libgpg-error-1.15.tar.bz2) = f41791121c66043fa18834597e0155ebcbff8ada 3SHA1 (libgpg-error-1.15.tar.bz2) = f41791121c66043fa18834597e0155ebcbff8ada
4RMD160 (libgpg-error-1.15.tar.bz2) = 09d050254364d27ba3b98156c4b66b1e9490084a 4RMD160 (libgpg-error-1.15.tar.bz2) = 09d050254364d27ba3b98156c4b66b1e9490084a
5Size (libgpg-error-1.15.tar.bz2) = 546865 bytes 5Size (libgpg-error-1.15.tar.bz2) = 546865 bytes
 6SHA1 (patch-src_estream.c) = e3086b363ef14f1b24cac7334c8ecbf8e94ddd3b
6SHA1 (patch-src_gpg-error-config.in) = e22e99208192971f8c123d7ee9b22c5f615669e1 7SHA1 (patch-src_gpg-error-config.in) = e22e99208192971f8c123d7ee9b22c5f615669e1
7SHA1 (patch-src_gpgrt-int.h) = 151ce28066bb456984e4ff53211d454ea4426cff 8SHA1 (patch-src_gpgrt-int.h) = 151ce28066bb456984e4ff53211d454ea4426cff

File Added: pkgsrc/security/libgpg-error/patches/patch-src_estream.c
$NetBSD: patch-src_estream.c,v 1.1.2.2 2014/10/29 20:11:31 tron Exp $

Don't use atexit(), since this library mey be dlopen()ed
and dlclose()d before exit() is called.

Instead mark the do_deinit() function as a destructor.

--- src/estream.c.orig	2014-09-11 09:38:21.000000000 +0000
+++ src/estream.c
@@ -471,6 +471,7 @@ do_list_remove (estream_t stream, int wi
 
 
 
+__attribute__((destructor,used))
 static void
 do_deinit (void)
 {
@@ -503,7 +504,16 @@ _gpgrt_es_init (void)
   if (!initialized)
     {
       initialized = 1;
+#if 0
+      /* This library may be unloaded via dlclose() before
+       * exit() is called, causing the atexit handler to try
+       * to jump into unmapped address space, causing a segfault.
+       * This has been observed with apache and php.  Instead, use
+       * the destructor attribute, since that will cause it
+       * to be called on dlclose() as well.
+       */
       atexit (do_deinit);
+#endif
     }
   return 0;
 }