Mon Apr 1 12:12:47 2013 UTC ()
Fix assertions on NetBSD when trying to use a thread-specific storage
key after it has been removed. Bump revision.


(joerg)
diff -r1.132 -r1.133 pkgsrc/lang/mono/Makefile
diff -r1.87 -r1.88 pkgsrc/lang/mono/distinfo
diff -r1.4 -r1.5 pkgsrc/lang/mono/patches/patch-dg

cvs diff -r1.132 -r1.133 pkgsrc/lang/mono/Makefile (expand / switch to context diff)
--- pkgsrc/lang/mono/Makefile 2013/02/19 22:34:09 1.132
+++ pkgsrc/lang/mono/Makefile 2013/04/01 12:12:47 1.133
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.132 2013/02/19 22:34:09 joerg Exp $
+# $NetBSD: Makefile,v 1.133 2013/04/01 12:12:47 joerg Exp $
 
 DISTNAME=	mono-2.10.9
-PKGREVISION=	1
+PKGREVISION=	2
 CATEGORIES=	lang
 MASTER_SITES=	http://download.mono-project.com/sources/mono/
 EXTRACT_SUFX=	.tar.bz2

cvs diff -r1.87 -r1.88 pkgsrc/lang/mono/distinfo (expand / switch to context diff)
--- pkgsrc/lang/mono/distinfo 2013/01/19 14:38:26 1.87
+++ pkgsrc/lang/mono/distinfo 2013/04/01 12:12:47 1.88
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.87 2013/01/19 14:38:26 wiz Exp $
+$NetBSD: distinfo,v 1.88 2013/04/01 12:12:47 joerg Exp $
 
 SHA1 (mono-2.10.9.tar.bz2) = 1a6e8c5a0c3d88d87982259aa04402e028a283de
 RMD160 (mono-2.10.9.tar.bz2) = ac9784c413eb2cdb490750a86a96cce5c11ad5bd
@@ -33,7 +33,8 @@
 SHA1 (patch-dc) = e139e349217b213eea53a17fcae44fda0bbfe636
 SHA1 (patch-de) = d9867210a90389ff9ff5b9376b7091f923960973
 SHA1 (patch-df) = b817bb4dd09c4490efba749bf9c4a663253da11b
-SHA1 (patch-dg) = d6af013f17f293485ed8740e284f44a53467391e
+SHA1 (patch-dg) = 9e87267c6a85dd6f1f445eb303e8c2a40b57e39b
+SHA1 (patch-dg.diff) = c2218062c6d261fa44cc9a2664de8fd158462e19
 SHA1 (patch-dh) = 9d1603cb55658a378cf4af29e41d6215f6a080c9
 SHA1 (patch-di) = 925b26e848f5f25376a21948d0627e987cfaa467
 SHA1 (patch-dj) = acff1ca9b38b1c21ed545bcd4fb806c69e40c409

cvs diff -r1.4 -r1.5 pkgsrc/lang/mono/patches/Attic/patch-dg (expand / switch to context diff)
--- pkgsrc/lang/mono/patches/Attic/patch-dg 2011/04/25 14:01:40 1.4
+++ pkgsrc/lang/mono/patches/Attic/patch-dg 2013/04/01 12:12:47 1.5
@@ -1,7 +1,36 @@
-$NetBSD: patch-dg,v 1.4 2011/04/25 14:01:40 kefren Exp $
---- mono/metadata/threads.c.orig	2011-02-23 21:21:01.000000000 +0200
-+++ mono/metadata/threads.c	2011-04-25 12:32:08.000000000 +0300
-@@ -1002,8 +1002,16 @@ mono_thread_get_stack_bounds (guint8 **s
+$NetBSD: patch-dg,v 1.5 2013/04/01 12:12:47 joerg Exp $
+
+Avoid calling pthread_setspecific via SET_CURRENT_OBJECT(NULL)
+after the key has been removed. This can result in hangs or
+assertions.
+
+--- mono/metadata/threads.c.orig	2012-01-30 18:01:23.000000000 +0000
++++ mono/metadata/threads.c
+@@ -1,3 +1,4 @@
++
+ /*
+  * threads.c: Thread support internal calls
+  *
+@@ -77,6 +78,8 @@ extern int tkill (pid_t tid, int signal)
+ #   endif
+ #endif
+ 
++static int tls_key_initialised;
++
+ struct StartInfo 
+ {
+ 	guint32 (*func)(void *);
+@@ -814,7 +817,8 @@ static guint32 WINAPI start_wrapper_inte
+ 	 * Boehm GC - the io-layer keeps a GC-visible hash of pointers
+ 	 * to TLS data.)
+ 	 */
+-	SET_CURRENT_OBJECT (NULL);
++	if (tls_key_initialised)
++		SET_CURRENT_OBJECT (NULL);
+ 	mono_domain_unset ();
+ 
+ 	return(0);
+@@ -1016,8 +1020,16 @@ mono_thread_get_stack_bounds (guint8 **s
  #    if !defined(__OpenBSD__)
  	pthread_attr_getstack (&attr, (void**)staddr, stsize);
  #    endif
@@ -18,3 +47,19 @@
  #  endif
  
  	pthread_attr_destroy (&attr);
+@@ -2651,6 +2663,7 @@ void mono_thread_init (MonoThreadStartCB
+ 	mono_init_static_data_info (&context_static_info);
+ 
+ 	mono_native_tls_alloc (&current_object_key, NULL);
++	tls_key_initialised = 1;
+ 	THREAD_DEBUG (g_message ("%s: Allocated current_object_key %d", __func__, current_object_key));
+ 
+ 	mono_thread_start_cb = start_cb;
+@@ -2701,6 +2714,7 @@ void mono_thread_cleanup (void)
+ 	delayed_free_table = NULL;
+ 
+ 	mono_native_tls_free (current_object_key);
++	tls_key_initialised = 0;
+ }
+ 
+ void