From root@cainites.net  Fri Nov 12 10:52:19 2004
Return-Path: <root@cainites.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 8E23716A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 12 Nov 2004 10:52:19 +0000 (GMT)
Received: from mail.cainites.net (caine.xs4all.nl [80.126.212.243])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B35FC43D31
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 12 Nov 2004 10:52:16 +0000 (GMT)
	(envelope-from root@cainites.net)
Received: from localhost (localhost.cainites.net [127.0.0.1])
	by mail.cainites.net (Postfix) with ESMTP id C9324226
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 12 Nov 2004 11:52:14 +0100 (CET)
Received: from mail.cainites.net ([127.0.0.1])
 by localhost (lan.cainites.net [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 61044-01 for <FreeBSD-gnats-submit@freebsd.org>;
 Fri, 12 Nov 2004 11:52:08 +0100 (CET)
Received: by mail.cainites.net (Postfix, from userid 0)
	id 8B913F2; Fri, 12 Nov 2004 11:52:08 +0100 (CET)
Message-Id: <20041112105208.8B913F2@mail.cainites.net>
Date: Fri, 12 Nov 2004 11:52:08 +0100 (CET)
From: Ralf van der Enden <tremere@cainites.net>
Reply-To: Ralf van der Enden <tremere@cainites.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: pdns_recursor related issues fixed
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         73862
>Category:       ports
>Synopsis:       pdns_recursor related issues fixed
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    nork
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 12 11:00:51 GMT 2004
>Closed-Date:    Fri Nov 19 16:41:14 GMT 2004
>Last-Modified:  Fri Nov 19 16:41:14 GMT 2004
>Originator:     Ralf van der Enden
>Release:        FreeBSD 5.3-RELEASE i386
>Organization:
>Environment:
System: FreeBSD lan.cainites.net 5.3-RELEASE FreeBSD 5.3-RELEASE #0: Sun Nov 7 17:28:36 CET 2004 root@lan.cainites.net:/usr/obj/usr/src/sys/HELLKERNEL i386


	
>Description:
There seems to be a problem running the pdns_recursor on FreeBSD 5.3 systems.
In order to workaround the coredump I've added a fix which adds a few lines to
/etc/libmap.conf
Second, I've added some checks when compiling the recursor since it only seems
to run on FBSD 5.0+
>How-To-Repeat:
>Fix:

	

--- pdns-2.9.16_5.diff begins here ---
diff -ruN powerdns.orig/Makefile powerdns/Makefile
--- powerdns.orig/Makefile	Mon Nov  8 00:29:43 2004
+++ powerdns/Makefile	Fri Nov 12 10:25:09 2004
@@ -7,7 +7,7 @@
 
 PORTNAME=	powerdns
 PORTVERSION=	2.9.16
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	dns ipv6
 MASTER_SITES=	http://downloads.powerdns.com/releases/
 DISTNAME=	pdns-${PORTVERSION}
@@ -29,6 +29,7 @@
 		POWERDNS_OPTIONS="${POWERDNS_OPTIONS}"
 MAN8=		pdns_control.8 pdns_server.8 zone2sql.8
 STARTUP_SCRIPT=	${PREFIX}/etc/rc.d/pdns.sh.sample
+LIBMAP_CONF=	/etc/libmap.conf
 
 # use user config if possible
 .if exists(${WRKDIRPREFIX}${.CURDIR}/Makefile.inc)
@@ -63,7 +64,6 @@
 USE_OPENLDAP?=		YES
 USE_LIBTOOL_VER=	13
 INSTALLS_SHLIB=		YES
-USE_GCC=3.2
 CONFIGURE_MODULES+=	"ldap"
 PLIST_SUB+=		WITHLDAP=""
 .else
@@ -80,7 +80,6 @@
 .endif
 
 .if defined(POWERDNS_WITH_RECURSOR)
-USE_GCC=3.2
 CONFIGURE_ARGS+=	--enable-recursor
 PLIST_SUB+=		RECURSOR=""
 .else
@@ -90,13 +89,19 @@
 .include <bsd.port.pre.mk>
 
 .if defined(POWERDNS_WITH_RECURSOR)
-.if exists(/usr/include/ucontext.h)
+.if exists(/usr/include/ucontext.h) && ${OSVERSION} >= 500000
 UCONTEXT!=	${AWK} '/setcontext/ { print "YES" }' \
 		/usr/include/ucontext.h
 .if ${UCONTEXT} == ""
-BROKEN=		setcontext for recursor not found
+BROKEN=		setcontext for recursor not found or FreeBSD version lower than 5.0
+.endif
 .endif
 .endif
+
+.if defined(POWERDNS_WITH_RECURSOR) || defined(WITH_LDAP)
+.if ${OSVERSION} < 500039
+USE_GCC=3.2
+.endif
 .endif
 
 .if defined(NO_DESCRIBE)
@@ -134,11 +139,23 @@
 .endfor
 .endif
 .if !exists(${STARTUP_SCRIPT})
-	${ECHO_MSG} "Installing ${STARTUP_SCRIPT} startup file."
+	@${ECHO_MSG} "Installing ${STARTUP_SCRIPT} startup file."
 	${SED} -e "s=%%PREFIX%%=${PREFIX}=" \
 		${FILESDIR}/pdns.sh.sample  \
 		> ${WRKSRC}/pdns.sh.sample
 	${INSTALL_SCRIPT} ${WRKSRC}/pdns.sh.sample ${STARTUP_SCRIPT}
+.endif
+.if defined(POWERDNS_WITH_RECURSOR)
+.if !exists(${LIBMAP_CONF})
+	@${ECHO_MSG} "# Start of fix (pdns_recursor)" > ${LIBMAP_CONF}
+.else
+	@${ECHO_MSG} "# Start of fix (pdns_recursor)" >> ${LIBMAP_CONF}
+.endif
+	@${ECHO_MSG} "Installing fix in /etc/libmap.conf for pdns_recursor."
+	@${ECHO_MSG} "[pdns_recursor]" >> ${LIBMAP_CONF}
+	@${ECHO_MSG} "libpthread.so.1		libc_r.so.5" >> ${LIBMAP_CONF}
+	@${ECHO_MSG} "libpthread.so		libc_r.so" >> ${LIBMAP_CONF}
+	@${ECHO_MSG} "# End of fix (pdns_recursor)" >> ${LIBMAP_CONF}
 .endif
 
 .include <bsd.port.post.mk>
diff -ruN powerdns.orig/pkg-plist powerdns/pkg-plist
--- powerdns.orig/pkg-plist	Mon Nov  8 00:28:53 2004
+++ powerdns/pkg-plist	Fri Nov 12 10:25:01 2004
@@ -17,3 +17,5 @@
 %%PORTDOCS%%share/examples/powerdns/pdns_postgresql.sql
 %%PORTDOCS%%share/examples/powerdns/pdns_sqlite.sql
 %%PORTDOCS%%@dirrm share/examples/powerdns
+%%RECURSOR%%@unexec sed -e "/^# Start of fix (pdns_recursor)$/,/^# End of fix (pdns_recursor)$/d" < /etc/libmap.conf > /etc/libmap.conf.tmp
+%%RECURSOR%%@unexec mv /etc/libmap.conf.tmp /etc/libmap.conf
--- pdns-2.9.16_5.diff ends here ---


>Release-Note:
>Audit-Trail:
Class-Changed-From-To: sw-bug->maintainer-update 
Class-Changed-By: arved 
Class-Changed-When: Fri Nov 12 20:34:14 GMT 2004 
Class-Changed-Why:  
This is a maintainer-update 

http://www.freebsd.org/cgi/query-pr.cgi?pr=73862 

From: Pav Lucistnik <pav@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, tremere@cainites.net
Cc:  
Subject: Re: ports/73862: pdns_recursor related issues fixed
Date: Fri, 12 Nov 2004 22:58:51 +0100

 --=-kLr7tNyufbMX4JRp1FZC
 Content-Type: text/plain
 Content-Transfer-Encoding: quoted-printable
 
 Are you sure this is a correct thing to do? Don't you somehow ended with
 a pdns_recursor binary linked to both libc_r and libpthread? That's
 invalid state pointing at local problem and a recompile of affected
 binary and all libraries it links should fix it.
 
 I'm almost certain that solving this local problem by global libmap.conf
 hackage is a bad thing.
 
 --=20
 Pav Lucistnik <pav@oook.cz>
               <pav@FreeBSD.org>
 
 What luck - a dagger!  This is your holder.  Rest there and let me die.
 
 --=-kLr7tNyufbMX4JRp1FZC
 Content-Type: application/pgp-signature; name=signature.asc
 Content-Description: Toto je =?iso-8859-2?Q?digit=E1ln=EC?=
 	=?ISO-8859-1?Q?_podepsan=E1?= =?iso-8859-2?Q?_=E8=E1st?=
 	=?ISO-8859-1?Q?_zpr=E1vy?=
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.6 (FreeBSD)
 
 iD8DBQBBlTIbntdYP8FOsoIRAmlnAJsEBt3bN3x5StNrUBpZiBYMKxpfmgCbBKjh
 Xi06IB+HPV2tVSILeIVmBc0=
 =Ptcu
 -----END PGP SIGNATURE-----
 
 --=-kLr7tNyufbMX4JRp1FZC--

From: Ralf van der Enden <tremere@cainites.net>
To: freebsd-gnats-submit@FreeBSD.org, tremere@cainites.net
Cc:  
Subject: Re: ports/73862: pdns_recursor related issues fixed
Date: Mon, 15 Nov 2004 00:38:29 +0100

 Hello freebsd-gnats-submit,
 
   I've recompiled all my ports since my upgrade to 5.3 and this has
   been the only way for me to fix the pdns_recursor issue. It's linked
   to libpthread and by adding those lines to libmap.conf I make sure
   that's remapped to libc_r instead. I've notified the author of
   powerdns about this issue and hope he'll fix it in the new release.
   Until then this is the best I can do.
 
   Any other suggestions are welcome.
 
 -- 
 Best regards,
  Ralf                          mailto:tremere@cainites.net
 

From: Ralf van der Enden <tremere@cainites.net>
To: freebsd-gnats-submit@FreeBSD.org, tremere@cainites.net
Cc:  
Subject: Re: ports/73862: pdns_recursor related issues fixed
Date: Mon, 15 Nov 2004 00:41:49 +0100

 Hello freebsd-gnats-submit,
 
   By the way... I've not added a global remapping of libpthread to
   libc_r. As you might have noticed it only remaps those libraries for
   the pdns_recursor (I've followed the syntax as stated by the manpage
   for libmap.conf).
 
 -- 
 Best regards,
  Ralf                          mailto:tremere@cainites.net
 

From: Ralf van der Enden <tremere@cainites.net>
To: freebsd-gnats-submit@FreeBSD.org, tremere@cainites.net
Cc:  
Subject: Re: ports/73862: pdns_recursor related issues fixed
Date: Tue, 16 Nov 2004 23:10:24 +0100

 Hello freebsd-gnats-submit,
 
   Okay. I found the problem. Had to remove some manually added imports
   from the pthread + semaphore library and add the pthread.h and
   semaphore.h include files. Everything works smoothly again (I didn't
   even break it on versions prior to 5.3).
 
   Here's the new patch:
 
 --- pdns-2.9.16_5.diff begins here ---
 diff -ruN powerdns.orig/Makefile powerdns/Makefile
 --- powerdns.orig/Makefile      Mon Nov  8 00:29:43 2004
 +++ powerdns/Makefile   Tue Nov 16 21:41:44 2004
 @@ -7,7 +7,7 @@
  
  PORTNAME=      powerdns
  PORTVERSION=   2.9.16
 -PORTREVISION=  4
 +PORTREVISION=  5
  CATEGORIES=    dns ipv6
  MASTER_SITES=  http://downloads.powerdns.com/releases/
  DISTNAME=      pdns-${PORTVERSION}
 @@ -29,6 +29,7 @@
                 POWERDNS_OPTIONS="${POWERDNS_OPTIONS}"
  MAN8=          pdns_control.8 pdns_server.8 zone2sql.8
  STARTUP_SCRIPT=        ${PREFIX}/etc/rc.d/pdns.sh.sample
 +LIBMAP_CONF=   /etc/libmap.conf
  
  # use user config if possible
  .if exists(${WRKDIRPREFIX}${.CURDIR}/Makefile.inc)
 @@ -63,7 +64,6 @@
  USE_OPENLDAP?=         YES
  USE_LIBTOOL_VER=       13
  INSTALLS_SHLIB=                YES
 -USE_GCC=3.2
  CONFIGURE_MODULES+=    "ldap"
  PLIST_SUB+=            WITHLDAP=""
  .else
 @@ -80,7 +80,6 @@
  .endif
  
  .if defined(POWERDNS_WITH_RECURSOR)
 -USE_GCC=3.2
  CONFIGURE_ARGS+=       --enable-recursor
  PLIST_SUB+=            RECURSOR=""
  .else
 @@ -90,13 +89,19 @@
  .include <bsd.port.pre.mk>
  
  .if defined(POWERDNS_WITH_RECURSOR)
 -.if exists(/usr/include/ucontext.h)
 +.if exists(/usr/include/ucontext.h) && ${OSVERSION} >= 500000
  UCONTEXT!=     ${AWK} '/setcontext/ { print "YES" }' \
                 /usr/include/ucontext.h
  .if ${UCONTEXT} == ""
 -BROKEN=                setcontext for recursor not found
 +BROKEN=                setcontext for recursor not found or FreeBSD version lower than 5.0
 +.endif
  .endif
  .endif
 +
 +.if defined(POWERDNS_WITH_RECURSOR) || defined(WITH_LDAP)
 +.if ${OSVERSION} < 500039
 +USE_GCC=3.2
 +.endif
  .endif
  
  .if defined(NO_DESCRIBE)
 @@ -134,7 +139,7 @@
  .endfor
  .endif
  .if !exists(${STARTUP_SCRIPT})
 -       ${ECHO_MSG} "Installing ${STARTUP_SCRIPT} startup file."
 +       @${ECHO_MSG} "Installing ${STARTUP_SCRIPT} startup file."
         ${SED} -e "s=%%PREFIX%%=${PREFIX}=" \
                 ${FILESDIR}/pdns.sh.sample  \
                 > ${WRKSRC}/pdns.sh.sample
 diff -ruN powerdns.orig/files/patch-pdns_pdns_recursor_cc powerdns/files/patch-pdns_pdns_recursor_cc
 --- powerdns.orig/files/patch-pdns_pdns_recursor_cc     Thu Jan  1 01:00:00 1970
 +++ powerdns/files/patch-pdns_pdns_recursor_cc  Tue Nov 16 21:34:51 2004
 @@ -0,0 +1,33 @@
 +--- pdns/pdns_recursor.cc.orig Tue Nov 16 21:21:59 2004
 ++++ pdns/pdns_recursor.cc      Tue Nov 16 21:22:31 2004
 +@@ -22,6 +22,8 @@
 + #include <errno.h>
 + #include <map>
 + #include <set>
 ++#include <semaphore.h>
 ++#include <pthread.h>
 + #ifndef WIN32
 + #include <netdb.h>
 + #endif // WIN32
 +@@ -42,21 +44,6 @@
 + MemRecursorCache RC;
 + 
 + string s_programname="pdns_recursor";
 +-
 +-#ifndef WIN32
 +-extern "C" {
 +-  int sem_init(sem_t*, int, unsigned int){return 0;}
 +-  int sem_wait(sem_t*){return 0;}
 +-  int sem_trywait(sem_t*){return 0;}
 +-  int sem_post(sem_t*){return 0;}
 +-  int sem_getvalue(sem_t*, int*){return 0;}
 +-  pthread_t pthread_self(void){return (pthread_t) 0;}
 +-  int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr){ return 0; }
 +-  int pthread_mutex_lock(pthread_mutex_t *mutex){ return 0; }
 +-  int pthread_mutex_unlock(pthread_mutex_t *mutex) { return 0; }
 +-
 +-}
 +-#endif // WIN32
 + 
 + StatBag S;
 + ArgvMap &arg()
 --- pdns-2.9.16_5.diff ends here ---
 
 
 -- 
 Best regards,
  Ralf                          mailto:tremere@cainites.net
 
Responsible-Changed-From-To: freebsd-ports-bugs->nork 
Responsible-Changed-By: nork 
Responsible-Changed-When: Fri Nov 19 16:14:02 GMT 2004 
Responsible-Changed-Why:  
I'll handle this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=73862 
State-Changed-From-To: open->closed 
State-Changed-By: nork 
State-Changed-When: Fri Nov 19 16:41:01 GMT 2004 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=73862 
>Unformatted:
