pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/seamonkey seamonkey: Workaround broken pthread_equ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/49c14a5acdb9
branches:  trunk
changeset: 423028:49c14a5acdb9
user:      kamil <kamil%pkgsrc.org@localhost>
date:      Sat Feb 08 22:59:55 2020 +0000

description:
seamonkey: Workaround broken pthread_equal() usage

Switch to an internal version of pthread_equal() without sanity checks.

Problems detected on NetBSD 9.99.46.

diffstat:

 www/seamonkey/Makefile                                                |    4 +-
 www/seamonkey/distinfo                                                |    3 +-
 www/seamonkey/patches/patch-mozilla_nsprpub_pr_src_pthreads_ptsynch.c |  106 ++++++++++
 3 files changed, 110 insertions(+), 3 deletions(-)

diffs (141 lines):

diff -r 6143cc163a6f -r 49c14a5acdb9 www/seamonkey/Makefile
--- a/www/seamonkey/Makefile    Sat Feb 08 22:59:32 2020 +0000
+++ b/www/seamonkey/Makefile    Sat Feb 08 22:59:55 2020 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.203 2020/01/26 17:32:24 rillig Exp $
+# $NetBSD: Makefile,v 1.204 2020/02/08 22:59:55 kamil Exp $
 
 DISTNAME=      seamonkey-${SM_VER}.source
 PKGNAME=       seamonkey-${SM_VER:S/b/beta/}
-PKGREVISION=   2
+PKGREVISION=   3
 SM_VER=                2.49.5
 CATEGORIES=    www
 MASTER_SITES=  ${MASTER_SITE_MOZILLA:=seamonkey/releases/${SM_VER}/source/}
diff -r 6143cc163a6f -r 49c14a5acdb9 www/seamonkey/distinfo
--- a/www/seamonkey/distinfo    Sat Feb 08 22:59:32 2020 +0000
+++ b/www/seamonkey/distinfo    Sat Feb 08 22:59:55 2020 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.159 2019/09/04 20:07:53 nia Exp $
+$NetBSD: distinfo,v 1.160 2020/02/08 22:59:55 kamil Exp $
 
 SHA1 (seamonkey-2.49.5.source.tar.xz) = 366953dee336185102d9a17028d49834cdb897d2
 RMD160 (seamonkey-2.49.5.source.tar.xz) = 6423a548286a166e88695060713afefd7365f389
@@ -86,6 +86,7 @@
 SHA1 (patch-mozilla_mozglue_build_arm.cpp) = 592ae5ce1a404227cc2ab6a06418cc813c5743c9
 SHA1 (patch-mozilla_mozglue_build_arm.h) = 94e2b1a1a9ebf20bfa8a542066aa0dad475db320
 SHA1 (patch-mozilla_netwerk_dns_moz.build) = d87c07ebfa01d32ca826932af733b37ce586e9f7
+SHA1 (patch-mozilla_nsprpub_pr_src_pthreads_ptsynch.c) = 05e410e27538083cde5f4c50089ea73d0ce16e9e
 SHA1 (patch-mozilla_old-configure.in) = e98e393a90c8283259d7c6fe2a2fff03f2747e4d
 SHA1 (patch-mozilla_security_manager_ssl_moz.build) = 70b36809c96e586c93af4ea54a383a74835b2192
 SHA1 (patch-mozilla_toolkit_components_osfile_modules_osfile__unix__back.jsm) = db4084f6a7dba2fc5d35cd256c6f149fabbf7bc7
diff -r 6143cc163a6f -r 49c14a5acdb9 www/seamonkey/patches/patch-mozilla_nsprpub_pr_src_pthreads_ptsynch.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/seamonkey/patches/patch-mozilla_nsprpub_pr_src_pthreads_ptsynch.c     Sat Feb 08 22:59:55 2020 +0000
@@ -0,0 +1,106 @@
+$NetBSD: patch-mozilla_nsprpub_pr_src_pthreads_ptsynch.c,v 1.5 2020/02/08 22:59:55 kamil Exp $
+
+Workaround buggy usage of pthread_equal().
+
+--- mozilla/nsprpub/pr/src/pthreads/ptsynch.c.orig     2019-05-06 17:30:52.000000000 +0000
++++ mozilla/nsprpub/pr/src/pthreads/ptsynch.c
+@@ -30,6 +30,13 @@ static pthread_t pt_zero_tid;  /* a null
+ #endif  /* defined(_PR_DCETHREADS) */
+ #endif  /* defined(DEBUG) */
+ 
++/* XXX, pthread_equal() is misused to compare non-valid thread pointers */
++static int
++pt_pthread_equal(pthread_t t1, pthread_t t2)
++{
++      return t1 == t2;
++}
++
+ #if defined(FREEBSD)
+ /*
+  * On older versions of FreeBSD, pthread_mutex_trylock returns EDEADLK.
+@@ -198,9 +205,9 @@ PR_IMPLEMENT(PRStatus) PR_Unlock(PRLock 
+     PR_ASSERT(lock != NULL);
+     PR_ASSERT(_PT_PTHREAD_MUTEX_IS_LOCKED(lock->mutex));
+     PR_ASSERT(PR_TRUE == lock->locked);
+-    PR_ASSERT(pthread_equal(lock->owner, self));
++    PR_ASSERT(pt_pthread_equal(lock->owner, self));
+ 
+-    if (!lock->locked || !pthread_equal(lock->owner, self))
++    if (!lock->locked || !pt_pthread_equal(lock->owner, self))
+         return PR_FAILURE;
+ 
+     lock->locked = PR_FALSE;
+@@ -223,7 +230,7 @@ PR_IMPLEMENT(void) PR_AssertCurrentThrea
+      * to the correctness of PR_AssertCurrentThreadOwnsLock(), but 
+      * this particular order makes the assertion more likely to
+      * catch errors. */
+-    PR_ASSERT(lock->locked && pthread_equal(lock->owner, pthread_self()));
++    PR_ASSERT(lock->locked && pt_pthread_equal(lock->owner, pthread_self()));
+ }
+ 
+ /**************************************************************/
+@@ -284,7 +291,7 @@ static void pt_PostNotifyToCvar(PRCondVa
+     _PT_Notified *notified = &cvar->lock->notified;
+ 
+     PR_ASSERT(PR_TRUE == cvar->lock->locked);
+-    PR_ASSERT(pthread_equal(cvar->lock->owner, pthread_self()));
++    PR_ASSERT(pt_pthread_equal(cvar->lock->owner, pthread_self()));
+     PR_ASSERT(_PT_PTHREAD_MUTEX_IS_LOCKED(cvar->lock->mutex));
+ 
+     while (1)
+@@ -367,7 +374,7 @@ PR_IMPLEMENT(PRStatus) PR_WaitCondVar(PR
+     PR_ASSERT(_PT_PTHREAD_MUTEX_IS_LOCKED(cvar->lock->mutex));
+     PR_ASSERT(PR_TRUE == cvar->lock->locked);
+     /* and it better be by us */
+-    PR_ASSERT(pthread_equal(cvar->lock->owner, pthread_self()));
++    PR_ASSERT(pt_pthread_equal(cvar->lock->owner, pthread_self()));
+ 
+     if (_PT_THREAD_INTERRUPTED(thred)) goto aborted;
+ 
+@@ -565,7 +572,7 @@ PR_IMPLEMENT(PRIntn) PR_GetMonitorEntryC
+ 
+     rv = pthread_mutex_lock(&mon->lock);
+     PR_ASSERT(0 == rv);
+-    if (pthread_equal(mon->owner, self))
++    if (pt_pthread_equal(mon->owner, self))
+         count = mon->entryCount;
+     rv = pthread_mutex_unlock(&mon->lock);
+     PR_ASSERT(0 == rv);
+@@ -580,7 +587,7 @@ PR_IMPLEMENT(void) PR_AssertCurrentThrea
+     rv = pthread_mutex_lock(&mon->lock);
+     PR_ASSERT(0 == rv);
+     PR_ASSERT(mon->entryCount != 0 &&
+-              pthread_equal(mon->owner, pthread_self()));
++              pt_pthread_equal(mon->owner, pthread_self()));
+     rv = pthread_mutex_unlock(&mon->lock);
+     PR_ASSERT(0 == rv);
+ #endif
+@@ -596,7 +603,7 @@ PR_IMPLEMENT(void) PR_EnterMonitor(PRMon
+     PR_ASSERT(0 == rv);
+     if (mon->entryCount != 0)
+     {
+-        if (pthread_equal(mon->owner, self))
++        if (pt_pthread_equal(mon->owner, self))
+             goto done;
+         while (mon->entryCount != 0)
+         {
+@@ -627,8 +634,8 @@ PR_IMPLEMENT(PRStatus) PR_ExitMonitor(PR
+     PR_ASSERT(0 == rv);
+     /* the entries should be > 0 and we'd better be the owner */
+     PR_ASSERT(mon->entryCount > 0);
+-    PR_ASSERT(pthread_equal(mon->owner, self));
+-    if (mon->entryCount == 0 || !pthread_equal(mon->owner, self))
++    PR_ASSERT(pt_pthread_equal(mon->owner, self));
++    if (mon->entryCount == 0 || !pt_pthread_equal(mon->owner, self))
+     {
+         rv = pthread_mutex_unlock(&mon->lock);
+         PR_ASSERT(0 == rv);
+@@ -675,7 +682,7 @@ PR_IMPLEMENT(PRStatus) PR_Wait(PRMonitor
+     /* the entries better be positive */
+     PR_ASSERT(mon->entryCount > 0);
+     /* and it better be owned by us */
+-    PR_ASSERT(pthread_equal(mon->owner, pthread_self()));
++    PR_ASSERT(pt_pthread_equal(mon->owner, pthread_self()));
+ 
+     /* tuck these away 'till later */
+     saved_entries = mon->entryCount; 



Home | Main Index | Thread Index | Old Index