From nobody@FreeBSD.org  Mon Apr  7 10:38:12 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 92FF81065673
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  7 Apr 2008 10:38:12 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 8662A8FC21
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  7 Apr 2008 10:38:12 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m37Abx8J045744
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 7 Apr 2008 10:37:59 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m37AbxG3045743;
	Mon, 7 Apr 2008 10:37:59 GMT
	(envelope-from nobody)
Message-Id: <200804071037.m37AbxG3045743@www.freebsd.org>
Date: Mon, 7 Apr 2008 10:37:59 GMT
From: Simun Mikecin <numisemis@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] lang/see[-devel]: add locking for thread-safety
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         122525
>Category:       ports
>Synopsis:       [PATCH] lang/see[-devel]: add locking for thread-safety
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    itetcu
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 07 10:40:01 UTC 2008
>Closed-Date:    Fri May 09 17:11:28 UTC 2008
>Last-Modified:  Fri May  9 17:20:03 UTC 2008
>Originator:     Simun Mikecin
>Release:        FreeBSD/amd64 7.0-RELEASE
>Organization:
>Environment:
FreeBSD xxx 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Mon Feb 25 14:12:19 CET 2008     root@xxx:/usr/obj/usr/src.7.0/sys/XXX  amd64
>Description:
libsee/dtoa.c requires thread locking functions to be thread-safe.
This patch adds new option MULTIPLE_THREADS to both lang/see and lang/see-devel. With this option enabled libsee/dtoa.c is compiled with proper thread locking.

>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -urN see-devel.orig/Makefile see-devel/Makefile
--- see-devel.orig/Makefile	2008-04-06 12:03:46.000000000 +0200
+++ see-devel/Makefile	2008-04-07 12:30:38.425779648 +0200
@@ -7,6 +7,7 @@
 
 PORTNAME=	see
 PORTVERSION=	3.0.1376
+PORTREVISION=	1
 CATEGORIES=	lang devel
 MASTER_SITES=	http://www.evolane.com/download/mirror/etcl/ \
 		http://www.evolane.fr/download/mirror/etcl/
@@ -17,7 +18,8 @@
 
 OPTIONS=	GC "Use Boehm-Weiser garbage collection package" on \
 		OPTIMIZED_CFLAGS "Enable some additional optimizations" off \
-		SEE_DEBUG "Internal SEE library debugging" off
+		SEE_DEBUG "Internal SEE library debugging" off \
+		MULTIPLE_THREADS "Enable thread-safety" on
 
 CONFLICTS=	see-[0-9]*
 
@@ -32,6 +34,10 @@
 
 .include <bsd.port.pre.mk>
 
+.if defined(WITH_MULTIPLE_THREADS)
+CFLAGS+=	-DMULTIPLE_THREADS
+.endif
+
 .if !defined(WITH_SEE_DEBUG)
 CFLAGS+=	-DNDEBUG
 .endif
@@ -44,9 +50,11 @@
 LIB_DEPENDS+=	gc:${PORTSDIR}/devel/boehm-gc
 .else
 CONFIGURE_ARGS+=	--without-boehm-gc
+.if !defined(WITH_MULTIPLE_THREADS)
 PTHREAD_CFLAGS=
 PTHREAD_LIBS=
 .endif
+.endif
 
 post-patch:
 	@${REINPLACE_CMD} -e "s|PACKAGE_BUGREPORT='leonard@users|PACKAGE_BUGREPORT='leonard\\\@users|" \
diff -urN see-devel.orig/files/patch-libsee_dtoa.c see-devel/files/patch-libsee_dtoa.c
--- see-devel.orig/files/patch-libsee_dtoa.c	1970-01-01 01:00:00.000000000 +0100
+++ see-devel/files/patch-libsee_dtoa.c	2008-04-07 11:34:32.013901000 +0200
@@ -0,0 +1,24 @@
+--- libsee/dtoa.c.orig	2005-12-24 04:35:38.000000000 +0100
++++ libsee/dtoa.c	2008-04-07 11:30:11.529829910 +0200
+@@ -168,6 +168,11 @@
+  *	the result overflows to +-Infinity or underflows to 0.
+  */
+ 
++#ifdef MULTIPLE_THREADS
++#include <pthread.h>
++static pthread_mutex_t mylock[2] = { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER };
++#endif
++
+ #ifndef Long
+ #define Long long
+ #endif
+@@ -470,6 +475,9 @@
+ #ifndef MULTIPLE_THREADS
+ #define ACQUIRE_DTOA_LOCK(n)	/*nothing*/
+ #define FREE_DTOA_LOCK(n)	/*nothing*/
++#else
++#define ACQUIRE_DTOA_LOCK(n)	pthread_mutex_lock(&mylock[n]);
++#define FREE_DTOA_LOCK(n)	pthread_mutex_unlock(&mylock[n]);
+ #endif
+ 
+ #define Kmax 15
diff -urN see.orig/Makefile see/Makefile
--- see.orig/Makefile	2008-01-29 10:36:02.000000000 +0100
+++ see/Makefile	2008-04-07 12:19:31.878542851 +0200
@@ -7,6 +7,7 @@
 
 PORTNAME=	see
 PORTVERSION=	2.0.1131
+PORTREVISION=	1
 CATEGORIES=	lang devel
 MASTER_SITES=	http://www.powerband.net.au/~david.leonard/ \
 		http://freshmeat.net/redir/see/45974/url_tgz/
@@ -16,7 +17,8 @@
 
 OPTIONS=	GC "Use Boehm-Weiser garbage collection package" on \
 		OPTIMIZED_CFLAGS "Enable some additional optimizations" off \
-		SEE_DEBUG "Internal SEE library debugging" off
+		SEE_DEBUG "Internal SEE library debugging" off \
+		MULTIPLE_THREADS "Enable thread-safety" on
 
 CONFLICTS=	see-devel-[0-9]*
 
@@ -33,6 +35,10 @@
 
 .include <bsd.port.pre.mk>
 
+.if defined(WITH_MULTIPLE_THREADS)
+CFLAGS+=	-DMULTIPLE_THREADS
+.endif
+
 .if !defined(WITH_SEE_DEBUG)
 CFLAGS+=	-DNDEBUG
 .endif
@@ -45,9 +51,11 @@
 LIB_DEPENDS+=	gc:${PORTSDIR}/devel/boehm-gc
 .else
 CONFIGURE_ARGS+=	--without-boehm-gc
+.if !defined(WITH_MULTIPLE_THREADS)
 PTHREAD_CFLAGS=
 PTHREAD_LIBS=
 .endif
+.endif
 
 post-patch:
 	@${REINPLACE_CMD} -e "s|PACKAGE_BUGREPORT='leonard@users|PACKAGE_BUGREPORT='leonard\\\@users|" \
diff -urN see.orig/files/patch-libsee_dtoa.c see/files/patch-libsee_dtoa.c
--- see.orig/files/patch-libsee_dtoa.c	1970-01-01 01:00:00.000000000 +0100
+++ see/files/patch-libsee_dtoa.c	2008-04-07 11:34:32.013901035 +0200
@@ -0,0 +1,24 @@
+--- libsee/dtoa.c.orig	2005-12-24 04:35:38.000000000 +0100
++++ libsee/dtoa.c	2008-04-07 11:30:11.529829910 +0200
+@@ -168,6 +168,11 @@
+  *	the result overflows to +-Infinity or underflows to 0.
+  */
+ 
++#ifdef MULTIPLE_THREADS
++#include <pthread.h>
++static pthread_mutex_t mylock[2] = { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER };
++#endif
++
+ #ifndef Long
+ #define Long long
+ #endif
+@@ -470,6 +475,9 @@
+ #ifndef MULTIPLE_THREADS
+ #define ACQUIRE_DTOA_LOCK(n)	/*nothing*/
+ #define FREE_DTOA_LOCK(n)	/*nothing*/
++#else
++#define ACQUIRE_DTOA_LOCK(n)	pthread_mutex_lock(&mylock[n]);
++#define FREE_DTOA_LOCK(n)	pthread_mutex_unlock(&mylock[n]);
+ #endif
+ 
+ #define Kmax 15


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->itetcu 
Responsible-Changed-By: itetcu 
Responsible-Changed-When: Fri May 9 15:53:43 UTC 2008 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=122525 
State-Changed-From-To: open->closed 
State-Changed-By: itetcu 
State-Changed-When: Fri May 9 17:11:27 UTC 2008 
State-Changed-Why:  
Committed. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/122525: commit references a PR
Date: Fri,  9 May 2008 17:10:08 +0000 (UTC)

 itetcu      2008-05-09 17:10:02 UTC
 
   FreeBSD ports repository
 
   Modified files:
     lang/see             Makefile 
   Added files:
     lang/see/files       patch-libsee_dtoa.c 
   Log:
   - add new option MULTIPLE_THREADS. With this option enabled libsee/dtoa.c is
   compiled with proper thread locking.
   - bump PORTVERSION
   
   PR:             ports/122525
   Submitted by:   maintainer
   
   Revision  Changes    Path
   1.13      +9 -1      ports/lang/see/Makefile
   1.1       +24 -0     ports/lang/see/files/patch-libsee_dtoa.c (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/122525: commit references a PR
Date: Fri,  9 May 2008 17:11:18 +0000 (UTC)

 itetcu      2008-05-09 17:11:13 UTC
 
   FreeBSD ports repository
 
   Modified files:
     lang/see-devel       Makefile 
   Added files:
     lang/see-devel/files patch-libsee_dtoa.c 
   Log:
   - add new option MULTIPLE_THREADS. With this option enabled libsee/dtoa.c is
   compiled with proper thread locking.
   - bump PORTVERSION
   
   PR:             ports/122525
   Submitted by:   maintainer
   
   Revision  Changes    Path
   1.16      +9 -1      ports/lang/see-devel/Makefile
   1.1       +24 -0     ports/lang/see-devel/files/patch-libsee_dtoa.c (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
