pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mail/thunderbird60 thunderbird60: Workaround broken pt...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c1d7ef0749bb
branches:  trunk
changeset: 411259:c1d7ef0749bb
user:      kamil <kamil%pkgsrc.org@localhost>
date:      Sat Feb 08 22:30:17 2020 +0000

description:
thunderbird60: Workaround broken pthread_equal() usage

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

Problems detected on NetBSD 9.99.46.

diffstat:

 mail/thunderbird60/Makefile                                        |    4 +-
 mail/thunderbird60/distinfo                                        |    3 +-
 mail/thunderbird60/patches/patch-nsprpub_pr_src_pthreads_ptsynch.c |  106 ++++++++++
 3 files changed, 110 insertions(+), 3 deletions(-)

diffs (141 lines):

diff -r bc3045b625a5 -r c1d7ef0749bb mail/thunderbird60/Makefile
--- a/mail/thunderbird60/Makefile       Sat Feb 08 22:26:42 2020 +0000
+++ b/mail/thunderbird60/Makefile       Sat Feb 08 22:30:17 2020 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.4 2020/01/05 02:20:08 ryoon Exp $
+# $NetBSD: Makefile,v 1.5 2020/02/08 22:30:17 kamil Exp $
 
 DISTNAME=      thunderbird-${TB_VER}.source
 PKGNAME=       thunderbird60-${TB_VER}
-PKGREVISION=   1
+PKGREVISION=   2
 TB_VER=                60.9.1
 CATEGORIES=    mail
 MASTER_SITES=  ${MASTER_SITE_MOZILLA:=thunderbird/releases/${TB_VER}/source/}
diff -r bc3045b625a5 -r c1d7ef0749bb mail/thunderbird60/distinfo
--- a/mail/thunderbird60/distinfo       Sat Feb 08 22:26:42 2020 +0000
+++ b/mail/thunderbird60/distinfo       Sat Feb 08 22:30:17 2020 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.3 2020/01/05 02:20:08 ryoon Exp $
+$NetBSD: distinfo,v 1.4 2020/02/08 22:30:17 kamil Exp $
 
 SHA1 (thunderbird-60.9.1.source.tar.xz) = ce6b4e411e8f5da3e217122e9bf61553ce76b1a7
 RMD160 (thunderbird-60.9.1.source.tar.xz) = 9e771f2540e34d222cfb85f3ae9e108364881209
@@ -39,6 +39,7 @@
 SHA1 (patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc) = 1e0e83fa9df5cd5c4ae83bc2fbfd08ebaba05d6b
 SHA1 (patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_video__capture__linux.cc) = b950dc99c51af7aa51f485457a0653aa9d17f5a4
 SHA1 (patch-modules_pdfium_update.sh) = 2aecc41e917781da55edfeb1c3a540548d2244aa
+SHA1 (patch-nsprpub_pr_src_pthreads_ptsynch.c) = 7e88040c16bc24b120ba69c74e91a80a727ce451
 SHA1 (patch-old-configure.in) = 8e90c04b1eefaff1822a89f5940a0e335c2c0b5e
 SHA1 (patch-servo_components_style__traits_lib.rs) = b07dfc91bae3f94b7da0c5dab523a6901b9b1bf7
 SHA1 (patch-servo_components_style_build__gecko.rs) = 3fd66ec7c6af23a3e2b3299b68c48777ab62b48b
diff -r bc3045b625a5 -r c1d7ef0749bb mail/thunderbird60/patches/patch-nsprpub_pr_src_pthreads_ptsynch.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mail/thunderbird60/patches/patch-nsprpub_pr_src_pthreads_ptsynch.c        Sat Feb 08 22:30:17 2020 +0000
@@ -0,0 +1,106 @@
+$NetBSD: patch-nsprpub_pr_src_pthreads_ptsynch.c,v 1.1 2020/02/08 22:30:18 kamil Exp $
+
+Workaround buggy usage of pthread_equal().
+
+--- nsprpub/pr/src/pthreads/ptsynch.c.orig     2019-10-31 12:34:24.000000000 +0000
++++ nsprpub/pr/src/pthreads/ptsynch.c
+@@ -25,6 +25,13 @@ static pthread_condattr_t _pt_cvar_attr;
+ extern PTDebug pt_debug;  /* this is shared between several modules */
+ #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.
+@@ -192,9 +199,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;
+@@ -217,7 +224,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()));
+ }
+ 
+ /**************************************************************/
+@@ -273,7 +280,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)
+@@ -356,7 +363,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;
+ 
+@@ -554,7 +561,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);
+@@ -569,7 +576,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
+@@ -585,7 +592,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)
+         {
+@@ -616,8 +623,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);
+@@ -664,7 +671,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