Wed Oct 29 12:28:50 2014 UTC ()
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.


(he)
diff -r1.43 -r1.44 pkgsrc/security/libgpg-error/Makefile
diff -r1.20 -r1.21 pkgsrc/security/libgpg-error/distinfo
diff -r0 -r1.1 pkgsrc/security/libgpg-error/patches/patch-src_estream.c

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

--- pkgsrc/security/libgpg-error/Makefile 2014/10/20 10:13:16 1.43
+++ pkgsrc/security/libgpg-error/Makefile 2014/10/29 12:28:50 1.44
@@ -1,16 +1,17 @@ @@ -1,16 +1,17 @@
1# $NetBSD: Makefile,v 1.43 2014/10/20 10:13:16 wiz Exp $ 1# $NetBSD: Makefile,v 1.44 2014/10/29 12:28:50 he Exp $
2 2
3DISTNAME= libgpg-error-1.17 3DISTNAME= libgpg-error-1.17
 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
@@ -22,27 +23,27 @@ MAKE_ENV+= LC_ALL="C" @@ -22,27 +23,27 @@ MAKE_ENV+= LC_ALL="C"
22MAKE_JOBS_SAFE= no 23MAKE_JOBS_SAFE= no
23INFO_FILES= yes 24INFO_FILES= yes
24 25
25.include "../../mk/bsd.prefs.mk" 26.include "../../mk/bsd.prefs.mk"
26 27
27.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS]) 28.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
28CONFIGURE_ENV+= CC_FOR_BUILD=${NATIVE_CC:Q} 29CONFIGURE_ENV+= CC_FOR_BUILD=${NATIVE_CC:Q}
29.else 30.else
30CONFIGURE_ENV+= CC_FOR_BUILD=${CC:Q}\ ${CFLAGS:M*:Q} 31CONFIGURE_ENV+= CC_FOR_BUILD=${CC:Q}\ ${CFLAGS:M*:Q}
31.endif 32.endif
32 33
33# XXX See HACKS 34# XXX See HACKS
34.if ${OPSYS} == "IRIX" || !empty(MACHINE_PLATFORM:MNetBSD-[3-9]*) 35.if ${OPSYS} == "IRIX" || !empty(MACHINE_PLATFORM:MNetBSD-[3-9]*)
35USE_TOOLS+= nawk 36USE_TOOLS+= awk
36.else 37.else
37USE_TOOLS+= gawk 38USE_TOOLS+= gawk
38.endif 39.endif
39 40
40# On Dragonfly i386, Pkgsrc libintl segfaults on bindtextdomain function 41# On Dragonfly i386, Pkgsrc libintl segfaults on bindtextdomain function
41# while locking a thread. Until that's resolved, stop libgpg-error from 42# while locking a thread. Until that's resolved, stop libgpg-error from
42# using NLS which invokes that function during initialization. 43# using NLS which invokes that function during initialization.
43PLIST_VARS+= nls 44PLIST_VARS+= nls
44.if ${OPSYS} == "DragonFly" && ${MACHINE} == "i386" 45.if ${OPSYS} == "DragonFly" && ${MACHINE} == "i386"
45CONFIGURE_ARGS+= --disable-nls 46CONFIGURE_ARGS+= --disable-nls
46.else 47.else
47PLIST.nls= yes 48PLIST.nls= yes
48.endif 49.endif

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

--- pkgsrc/security/libgpg-error/distinfo 2014/10/20 10:13:16 1.20
+++ pkgsrc/security/libgpg-error/distinfo 2014/10/29 12:28:50 1.21
@@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
1$NetBSD: distinfo,v 1.20 2014/10/20 10:13:16 wiz Exp $ 1$NetBSD: distinfo,v 1.21 2014/10/29 12:28:50 he Exp $
2 2
3SHA1 (libgpg-error-1.17.tar.bz2) = ba5858b2947e7272dd197c87bac9f32caf29b256 3SHA1 (libgpg-error-1.17.tar.bz2) = ba5858b2947e7272dd197c87bac9f32caf29b256
4RMD160 (libgpg-error-1.17.tar.bz2) = 3a86ef8773527b2e235e007981eda3472719e6b3 4RMD160 (libgpg-error-1.17.tar.bz2) = 3a86ef8773527b2e235e007981eda3472719e6b3
5Size (libgpg-error-1.17.tar.bz2) = 669914 bytes 5Size (libgpg-error-1.17.tar.bz2) = 669914 bytes
 6SHA1 (patch-src_estream.c) = e3086b363ef14f1b24cac7334c8ecbf8e94ddd3b
6SHA1 (patch-src_gpg-error-config.in) = e22e99208192971f8c123d7ee9b22c5f615669e1 7SHA1 (patch-src_gpg-error-config.in) = e22e99208192971f8c123d7ee9b22c5f615669e1

File Added: pkgsrc/security/libgpg-error/patches/patch-src_estream.c
$NetBSD: patch-src_estream.c,v 1.1 2014/10/29 12:28:50 he 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;
 }