NetBSD Problem Report #47595

From www@NetBSD.org  Mon Feb 25 19:45:01 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 014E363E522
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 25 Feb 2013 19:45:00 +0000 (UTC)
Message-Id: <20130225194500.0B7AB63E522@www.NetBSD.org>
Date: Mon, 25 Feb 2013 19:44:59 +0000 (UTC)
From: ef@math.uni-bonn.de
Reply-To: ef@math.uni-bonn.de
To: gnats-bugs@NetBSD.org
Subject: databases/nss_ldap configure fails to detect pthread_once()
X-Send-Pr-Version: www-1.0

>Number:         47595
>Category:       pkg
>Synopsis:       databases/nss_ldap configure fails to detect pthread_once()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 25 19:50:00 +0000 2013
>Originator:     Edgar Fuß
>Release:        pkgsrc-2012Q4
>Organization:
Mathematisches Institut der Uni Bonn
>Environment:
>Description:
A very strange problem I had (people not being put into their secondary groups on ssh login after switching LDAP to use STARTTLS) boils down to nss_ldap's configure script failing to detect the presence of pthread_once() on NetBSD.
[It then doesn't register pthread_atfork handlers, but later doesn't manually detect forks by PID comparison either because that logic tests on the presence of pthread_atfork, which succeeds. Oh well.]

The test for pthread_once fails in the first place because the test program doesn't #include <pthread.h> (which I learnt from ws@ does clever things to make ptherad_once() usable without linking against libpthread).
Even with #include <pthread.h>, it fails once because it does queer things #define'ing pthread_once itself, and another time by providing a built-in prototype differing from the real one.
With three patches, the test succeeds and the original problem disappears.

databases/nss_ldap is marked ONLY_FOR_PLATORM NetBSD, so probably a ssimple-minded patch is OK.

The issue has been reported upstream (http://bugzilla.padl.com/show_bug.cgi?id=437) over two years ago to no avail.
>How-To-Repeat:
cd databases/nss_ldap; make configure
look for "pthread_once"
>Fix:
--- configure.orig	2009-11-06 11:28:08.000000000 +0100
+++ configure	2011-08-06 16:46:23.000000000 +0200
@@ -10713,9 +10713,7 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
+#include <pthread.h>

 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
@@ -10728,16 +10726,11 @@
 # include <assert.h>
 #endif

-#undef $ac_func
-
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
 {
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char $ac_func ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.