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

Bug#688291: unblock: nspr/2:4.9.2-1



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package nspr

The only difference between 4.9.1 currently in testing and 4.9.2 currently
in unstable is an additional API to attach a name to a thread. This is used
in newer versions of Firefox/Iceweasel, which means it will make backports
to wheezy easier (at least until even newer versions of Firefox require even
newer APIs, but with the current trend of not using nspr that's less and less
likely)

Attaching git diff between the two revisions.

unblock nspr/2:4.9.2-1

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.5-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff --git a/debian/changelog b/debian/changelog
index 51c11ad..d1085cf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+nspr (2:4.9.2-1) unstable; urgency=low
+
+  * New upstream release.
+  * debian/libnspr4.symbols: Add new symbols.
+
+ -- Mike Hommey <glandium@debian.org>  Fri, 20 Jul 2012 08:40:44 +0200
+
 nspr (2:4.9.1-1) unstable; urgency=low
 
    * New upstream release. Now patch-free!
diff --git a/debian/libnspr4.symbols b/debian/libnspr4.symbols
index 8638cd4..e05e8d3 100644
--- a/debian/libnspr4.symbols
+++ b/debian/libnspr4.symbols
@@ -1,4 +1,5 @@
 libnspr4.so libnspr4 (>= 2:4.9-2~) | libnspr4-0d #MINVER#
+| libnspr4 #MINVER#
  GetExecutionEnvironment@Base 1.8.0.10
  LL_MaxInt@Base 1.8.0.10
  LL_MaxUint@Base 1.8.0.10
@@ -191,6 +192,7 @@ libnspr4.so libnspr4 (>= 2:4.9-2~) | libnspr4-0d #MINVER#
  PR_GetTCPMethods@Base 1.8.0.10
  PR_GetThreadAffinityMask@Base 1.8.0.10
  PR_GetThreadID@Base 1.8.0.10
+ PR_GetThreadName@Base 2:4.9.2 1
  PR_GetThreadPriority@Base 1.8.0.10
  PR_GetThreadPrivate@Base 1.8.0.10
  PR_GetThreadScope@Base 1.8.0.10
@@ -328,6 +330,7 @@ libnspr4.so libnspr4 (>= 2:4.9-2~) | libnspr4-0d #MINVER#
  PR_SetThreadAffinityMask@Base 1.8.0.10
  PR_SetThreadDumpProc@Base 1.8.0.10
  PR_SetThreadGCAble@Base 1.8.0.10
+ PR_SetCurrentThreadName@Base 2:4.9.2 1
  PR_SetThreadPriority@Base 1.8.0.10
  PR_SetThreadPrivate@Base 1.8.0.10
  PR_SetThreadRecycleMode@Base 1.8.0.10
diff --git a/debian/rules b/debian/rules
index 77021cf..9187c28 100755
--- a/debian/rules
+++ b/debian/rules
@@ -48,8 +48,6 @@ override_dh_auto_configure: $(PREPROCESS_FILES:.in=)
                     $(CONFIGURE_FLAGS) \
 		    --prefix=/usr \
 		    --libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
-		    --enable-ipv6 \
-		    --with-mozilla
 
 override_dh_auto_clean:
 	dh_auto_clean
diff --git a/mozilla/nsprpub/admin/repackage.sh b/mozilla/nsprpub/admin/repackage.sh
index 8a2b367..2f84803 100755
--- a/mozilla/nsprpub/admin/repackage.sh
+++ b/mozilla/nsprpub/admin/repackage.sh
@@ -32,10 +32,10 @@
 # 
 # ------------------------------------------------------------------
 
-FROMTOP=/share/builds/components/nspr20/v4.9.1
-TOTOP=./v4.9.1
-NSPRDIR=nspr-4.9.1
-SOURCETAG=NSPR_4_9_1_RTM
+FROMTOP=/share/builds/components/nspr20/v4.9.2
+TOTOP=./v4.9.2
+NSPRDIR=nspr-4.9.2
+SOURCETAG=NSPR_4_9_2_RTM
 
 #
 # enumerate Unix object directories on /s/b/c
diff --git a/mozilla/nsprpub/config/prdepend.h b/mozilla/nsprpub/config/prdepend.h
index 6c66b37..e49e926 100644
--- a/mozilla/nsprpub/config/prdepend.h
+++ b/mozilla/nsprpub/config/prdepend.h
@@ -10,4 +10,3 @@
  */
 
 #error "Do not include this header file."
-
diff --git a/mozilla/nsprpub/configure b/mozilla/nsprpub/configure
index 140225c..7493615 100755
--- a/mozilla/nsprpub/configure
+++ b/mozilla/nsprpub/configure
@@ -736,7 +736,7 @@ test "$host_alias" != "$target_alias" &&
 
 MOD_MAJOR_VERSION=4
 MOD_MINOR_VERSION=9
-MOD_PATCH_VERSION=1
+MOD_PATCH_VERSION=2
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
diff --git a/mozilla/nsprpub/configure.in b/mozilla/nsprpub/configure.in
index 285506d..da7961c 100644
--- a/mozilla/nsprpub/configure.in
+++ b/mozilla/nsprpub/configure.in
@@ -15,7 +15,7 @@ dnl = Defaults
 dnl ========================================================
 MOD_MAJOR_VERSION=4
 MOD_MINOR_VERSION=9
-MOD_PATCH_VERSION=1
+MOD_PATCH_VERSION=2
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
diff --git a/mozilla/nsprpub/pr/include/md/_win95.h b/mozilla/nsprpub/pr/include/md/_win95.h
index b3b88bd..a919e3a 100644
--- a/mozilla/nsprpub/pr/include/md/_win95.h
+++ b/mozilla/nsprpub/pr/include/md/_win95.h
@@ -362,6 +362,7 @@ extern PROsfd _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
 #define _MD_CREATE_THREAD           _PR_MD_CREATE_THREAD
 #define _MD_YIELD                   _PR_MD_YIELD
 #define _MD_SET_PRIORITY            _PR_MD_SET_PRIORITY
+#define _MD_SET_CURRENT_THREAD_NAME _PR_MD_SET_CURRENT_THREAD_NAME
 #define _MD_CLEAN_THREAD            _PR_MD_CLEAN_THREAD
 #define _MD_SETTHREADAFFINITYMASK   _PR_MD_SETTHREADAFFINITYMASK
 #define _MD_GETTHREADAFFINITYMASK   _PR_MD_GETTHREADAFFINITYMASK
diff --git a/mozilla/nsprpub/pr/include/md/_winnt.h b/mozilla/nsprpub/pr/include/md/_winnt.h
index 57423ea..4d4d2c1 100644
--- a/mozilla/nsprpub/pr/include/md/_winnt.h
+++ b/mozilla/nsprpub/pr/include/md/_winnt.h
@@ -376,6 +376,7 @@ extern int _PR_NTFiberSafeSelect(int, fd_set *, fd_set *, fd_set *,
 #define _MD_END_THREAD              _PR_MD_END_THREAD
 #define _MD_YIELD                   _PR_MD_YIELD
 #define _MD_SET_PRIORITY            _PR_MD_SET_PRIORITY
+#define _MD_SET_CURRENT_THREAD_NAME _PR_MD_SET_CURRENT_THREAD_NAME
 #define _MD_CLEAN_THREAD            _PR_MD_CLEAN_THREAD
 #define _MD_SETTHREADAFFINITYMASK   _PR_MD_SETTHREADAFFINITYMASK
 #define _MD_GETTHREADAFFINITYMASK   _PR_MD_GETTHREADAFFINITYMASK
diff --git a/mozilla/nsprpub/pr/include/prinit.h b/mozilla/nsprpub/pr/include/prinit.h
index edbb2af..ee631bf 100644
--- a/mozilla/nsprpub/pr/include/prinit.h
+++ b/mozilla/nsprpub/pr/include/prinit.h
@@ -31,10 +31,10 @@ PR_BEGIN_EXTERN_C
 ** The format of the version string is
 **     "<major version>.<minor version>[.<patch level>] [<Beta>]"
 */
-#define PR_VERSION  "4.9.1"
+#define PR_VERSION  "4.9.2"
 #define PR_VMAJOR   4
 #define PR_VMINOR   9
-#define PR_VPATCH   1
+#define PR_VPATCH   2
 #define PR_BETA     PR_FALSE
 
 /*
diff --git a/mozilla/nsprpub/pr/include/private/primpl.h b/mozilla/nsprpub/pr/include/private/primpl.h
index d86f66f..e9217f2 100644
--- a/mozilla/nsprpub/pr/include/private/primpl.h
+++ b/mozilla/nsprpub/pr/include/private/primpl.h
@@ -977,6 +977,9 @@ extern void _PR_MD_YIELD(void);
 extern void _PR_MD_SET_PRIORITY(_MDThread *md, PRThreadPriority newPri);
 #define    _PR_MD_SET_PRIORITY _MD_SET_PRIORITY
 
+extern void _PR_MD_SET_CURRENT_THREAD_NAME(const char *name);
+#define    _PR_MD_SET_CURRENT_THREAD_NAME _MD_SET_CURRENT_THREAD_NAME
+
 NSPR_API(void) _PR_MD_SUSPENDALL(void);
 #define    _PR_MD_SUSPENDALL _MD_SUSPENDALL
 
@@ -1533,6 +1536,7 @@ struct PRThread {
     PRIntn  errorStringLength;      /* textLength from last call to PR_SetErrorText() */
     PRInt32 errorStringSize;        /* malloc()'d size of buffer | zero */
     char *errorString;              /* current error string | NULL */
+    char *name;                     /* thread's name */
 
 #if defined(_PR_PTHREADS)
     pthread_t id;                   /* pthread identifier for the thread */
diff --git a/mozilla/nsprpub/pr/include/prthread.h b/mozilla/nsprpub/pr/include/prthread.h
index f38ff69..708c889 100644
--- a/mozilla/nsprpub/pr/include/prthread.h
+++ b/mozilla/nsprpub/pr/include/prthread.h
@@ -145,6 +145,17 @@ NSPR_API(PRThreadPriority) PR_GetThreadPriority(const PRThread *thread);
 NSPR_API(void) PR_SetThreadPriority(PRThread *thread, PRThreadPriority priority);
 
 /*
+** Set the name of the current thread, which will be visible in a debugger
+** and accessible via a call to PR_GetThreadName().
+*/
+NSPR_API(PRStatus) PR_SetCurrentThreadName(const char *name);
+
+/*
+** Return the name of "thread", if set.  Otherwise return NULL.
+*/
+NSPR_API(const char *) PR_GetThreadName(const PRThread *thread);
+
+/*
 ** This routine returns a new index for per-thread-private data table. 
 ** The index is visible to all threads within a process. This index can 
 ** be used with the PR_SetThreadPrivate() and PR_GetThreadPrivate() routines 
diff --git a/mozilla/nsprpub/pr/src/md/windows/ntthread.c b/mozilla/nsprpub/pr/src/md/windows/ntthread.c
index 5f9e646..3814142 100644
--- a/mozilla/nsprpub/pr/src/md/windows/ntthread.c
+++ b/mozilla/nsprpub/pr/src/md/windows/ntthread.c
@@ -276,6 +276,42 @@ _PR_MD_SET_PRIORITY(_MDThread *thread, PRThreadPriority newPri)
     return;
 }
 
+const DWORD MS_VC_EXCEPTION = 0x406D1388;
+
+#pragma pack(push,8)
+typedef struct tagTHREADNAME_INFO
+{
+   DWORD dwType; // Must be 0x1000.
+   LPCSTR szName; // Pointer to name (in user addr space).
+   DWORD dwThreadID; // Thread ID (-1=caller thread).
+   DWORD dwFlags; // Reserved for future use, must be zero.
+} THREADNAME_INFO;
+#pragma pack(pop)
+
+void
+_PR_MD_SET_CURRENT_THREAD_NAME(const char *name)
+{
+#ifdef _MSC_VER
+   THREADNAME_INFO info;
+
+   if (!IsDebuggerPresent())
+      return;
+
+   info.dwType = 0x1000;
+   info.szName = (char*) name;
+   info.dwThreadID = -1;
+   info.dwFlags = 0;
+
+   __try {
+      RaiseException(MS_VC_EXCEPTION,
+                     0,
+                     sizeof(info) / sizeof(ULONG_PTR),
+                     (ULONG_PTR*)&info);
+   } __except(EXCEPTION_CONTINUE_EXECUTION) {
+   }
+#endif
+}
+
 void
 _PR_MD_CLEAN_THREAD(PRThread *thread)
 {
diff --git a/mozilla/nsprpub/pr/src/md/windows/w95thred.c b/mozilla/nsprpub/pr/src/md/windows/w95thred.c
index dc0eac3..be92e20 100644
--- a/mozilla/nsprpub/pr/src/md/windows/w95thred.c
+++ b/mozilla/nsprpub/pr/src/md/windows/w95thred.c
@@ -168,6 +168,42 @@ _PR_MD_SET_PRIORITY(_MDThread *thread, PRThreadPriority newPri)
     return;
 }
 
+const DWORD MS_VC_EXCEPTION = 0x406D1388;
+
+#pragma pack(push,8)
+typedef struct tagTHREADNAME_INFO
+{
+   DWORD dwType; // Must be 0x1000.
+   LPCSTR szName; // Pointer to name (in user addr space).
+   DWORD dwThreadID; // Thread ID (-1=caller thread).
+   DWORD dwFlags; // Reserved for future use, must be zero.
+} THREADNAME_INFO;
+#pragma pack(pop)
+
+void
+_PR_MD_SET_CURRENT_THREAD_NAME(const char *name)
+{
+#ifdef _MSC_VER
+   THREADNAME_INFO info;
+
+   if (!IsDebuggerPresent())
+      return;
+
+   info.dwType = 0x1000;
+   info.szName = (char*) name;
+   info.dwThreadID = -1;
+   info.dwFlags = 0;
+
+   __try {
+      RaiseException(MS_VC_EXCEPTION,
+                     0,
+                     sizeof(info) / sizeof(ULONG_PTR),
+                     (ULONG_PTR*)&info);
+   } __except(EXCEPTION_CONTINUE_EXECUTION) {
+   }
+#endif
+}
+
 void
 _PR_MD_CLEAN_THREAD(PRThread *thread)
 {
diff --git a/mozilla/nsprpub/pr/src/nspr.def b/mozilla/nsprpub/pr/src/nspr.def
index c6618a8..7777a3d 100644
--- a/mozilla/nsprpub/pr/src/nspr.def
+++ b/mozilla/nsprpub/pr/src/nspr.def
@@ -446,3 +446,8 @@ EXPORTS ;-
 ;+      global:
                 PR_GetVersion;
 ;+} NSPR_4.8;
+;+NSPR_4.9.2 {
+;+      global:
+		PR_GetThreadName;
+		PR_SetCurrentThreadName;
+;+} NSPR_4.8.9;
diff --git a/mozilla/nsprpub/pr/src/pthreads/ptthread.c b/mozilla/nsprpub/pr/src/pthreads/ptthread.c
index c3223bb..d78dafa 100644
--- a/mozilla/nsprpub/pr/src/pthreads/ptthread.c
+++ b/mozilla/nsprpub/pr/src/pthreads/ptthread.c
@@ -19,6 +19,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <signal.h>
+#include <dlfcn.h>
 
 #ifdef SYMBIAN
 /* In Open C sched_get_priority_min/max do not work properly, so we undefine
@@ -794,6 +795,8 @@ static void _pt_thread_death_internal(void *arg, PRBool callDestructors)
     PR_Free(thred->privateData);
     if (NULL != thred->errorString)
         PR_Free(thred->errorString);
+    if (NULL != thred->name)
+        PR_Free(thred->name);
     PR_Free(thred->stack);
     if (NULL != thred->syspoll_list)
         PR_Free(thred->syspoll_list);
@@ -1612,6 +1615,88 @@ PR_IMPLEMENT(void*)PR_GetSP(PRThread *thred)
 
 #endif /* !defined(_PR_DCETHREADS) */
 
+PR_IMPLEMENT(PRStatus) PR_SetCurrentThreadName(const char *name)
+{
+    PRThread *thread;
+    size_t nameLen;
+    int result;
+
+    if (!name) {
+        PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
+        return PR_FAILURE;
+    }
+
+    thread = PR_GetCurrentThread();
+    if (!thread)
+        return PR_FAILURE;
+
+    PR_Free(thread->name);
+    nameLen = strlen(name);
+    thread->name = (char *)PR_Malloc(nameLen + 1);
+    if (!thread->name)
+        return PR_FAILURE;
+    memcpy(thread->name, name, nameLen + 1);
+
+#if defined(OPENBSD) || defined(FREEBSD)
+    result = pthread_set_name_np(thread->id, name);
+#else /* not BSD */
+    /*
+     * On OSX, pthread_setname_np is only available in 10.6 or later, so test
+     * for it at runtime.  It also may not be available on all linux distros.
+     */
+#if defined(DARWIN)
+    int (*dynamic_pthread_setname_np)(const char*);
+#else
+    int (*dynamic_pthread_setname_np)(pthread_t, const char*);
+#endif
+
+    *(void**)(&dynamic_pthread_setname_np) =
+        dlsym(RTLD_DEFAULT, "pthread_setname_np");
+    if (!dynamic_pthread_setname_np)
+        return PR_SUCCESS;
+
+    /*
+     * The 15-character name length limit is an experimentally determined
+     * length of a null-terminated string that most linux distros and OS X
+     * accept as an argument to pthread_setname_np.  Otherwise the E2BIG
+     * error is returned by the function.
+     */
+#define SETNAME_LENGTH_CONSTRAINT 15
+#define SETNAME_FRAGMENT1_LENGTH (SETNAME_LENGTH_CONSTRAINT >> 1)
+#define SETNAME_FRAGMENT2_LENGTH \
+    (SETNAME_LENGTH_CONSTRAINT - SETNAME_FRAGMENT1_LENGTH - 1)
+    char name_dup[SETNAME_LENGTH_CONSTRAINT + 1];
+    if (nameLen > SETNAME_LENGTH_CONSTRAINT) {
+        memcpy(name_dup, name, SETNAME_FRAGMENT1_LENGTH);
+        name_dup[SETNAME_FRAGMENT1_LENGTH] = '~';
+        /* Note that this also copies the null terminator. */
+        memcpy(name_dup + SETNAME_FRAGMENT1_LENGTH + 1,
+               name + nameLen - SETNAME_FRAGMENT2_LENGTH,
+               SETNAME_FRAGMENT2_LENGTH + 1);
+        name = name_dup;
+    }
+
+#if defined(DARWIN)
+    result = dynamic_pthread_setname_np(name);
+#else
+    result = dynamic_pthread_setname_np(thread->id, name);
+#endif
+#endif /* not BSD */
+
+    if (result) {
+        PR_SetError(PR_UNKNOWN_ERROR, result);
+        return PR_FAILURE;
+    }
+    return PR_SUCCESS;
+}
+
+PR_IMPLEMENT(const char *) PR_GetThreadName(const PRThread *thread)
+{
+    if (!thread)
+        return NULL;
+    return thread->name;
+}
+
 #endif  /* defined(_PR_PTHREADS) || defined(_PR_DCETHREADS) */
 
 /* ptthread.c */
diff --git a/mozilla/nsprpub/pr/src/threads/combined/pruthr.c b/mozilla/nsprpub/pr/src/threads/combined/pruthr.c
index 53eea1f..7ecccf5 100644
--- a/mozilla/nsprpub/pr/src/threads/combined/pruthr.c
+++ b/mozilla/nsprpub/pr/src/threads/combined/pruthr.c
@@ -237,6 +237,7 @@ static void _PR_InitializeRecycledThread(PRThread *thread)
     PR_ASSERT(thread->dumpArg == 0 && thread->dump == 0);
     PR_ASSERT(thread->errorString == 0 && thread->errorStringSize == 0);
     PR_ASSERT(thread->errorStringLength == 0);
+    PR_ASSERT(thread->name == 0);
 
     /* Reset data members in thread structure */
     thread->errorCode = thread->osErrorCode = 0;
@@ -1581,6 +1582,37 @@ PR_IMPLEMENT(void) PR_SetThreadPriority(PRThread *thread,
     } else _PR_SetThreadPriority(thread, newPri);
 }
 
+PR_IMPLEMENT(PRStatus) PR_SetCurrentThreadName(const char *name)
+{
+    PRThread *thread;
+    size_t nameLen;
+
+    if (!name) {
+        PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
+        return PR_FAILURE;
+    }
+
+    thread = PR_GetCurrentThread();
+    if (!thread)
+        return PR_FAILURE;
+
+    PR_Free(thread->name);
+    nameLen = strlen(name);
+    thread->name = (char *)PR_Malloc(nameLen + 1);
+    if (!thread->name)
+        return PR_FAILURE;
+    memcpy(thread->name, name, nameLen + 1);
+    _PR_MD_SET_CURRENT_THREAD_NAME(thread->name);
+    return PR_SUCCESS;
+}
+
+PR_IMPLEMENT(const char *) PR_GetThreadName(const PRThread *thread)
+{
+    if (!thread)
+        return NULL;
+    return thread->name;
+}
+
 
 /*
 ** This routine prevents all other threads from running. This call is needed by 
diff --git a/mozilla/nsprpub/pr/src/threads/prcthr.c b/mozilla/nsprpub/pr/src/threads/prcthr.c
index 4f9a3be..2688144 100644
--- a/mozilla/nsprpub/pr/src/threads/prcthr.c
+++ b/mozilla/nsprpub/pr/src/threads/prcthr.c
@@ -35,6 +35,7 @@ void _PR_CleanupThread(PRThread *thread)
     }
     thread->dump = 0;
 
+    PR_DELETE(thread->name);
     PR_DELETE(thread->errorString);
     thread->errorStringSize = 0;
     thread->errorStringLength = 0;
diff --git a/mozilla/nsprpub/pr/tests/vercheck.c b/mozilla/nsprpub/pr/tests/vercheck.c
index 415caae..2f42523 100644
--- a/mozilla/nsprpub/pr/tests/vercheck.c
+++ b/mozilla/nsprpub/pr/tests/vercheck.c
@@ -20,9 +20,10 @@
 #include <stdlib.h>
 
 /*
- * This release (4.9.1) is backward compatible with the
+ * This release (4.9.2) is backward compatible with the
  * 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, 4.7.x,
- * 4.8.x, and 4.9 releases.  It, of course, is compatible with itself.
+ * 4.8.x, 4.9, and 4.9.1 releases.  It, of course,
+ * is compatible with itself.
  */
 static char *compatible_version[] = {
     "4.0", "4.0.1", "4.1", "4.1.1", "4.1.2", "4.1.3",
@@ -34,7 +35,7 @@ static char *compatible_version[] = {
     "4.7.6",
     "4.8", "4.8.1", "4.8.2", "4.8.3", "4.8.4", "4.8.5",
     "4.8.6", "4.8.7", "4.8.8", "4.8.9",
-    "4.9", PR_VERSION
+    "4.9", "4.9.1", PR_VERSION
 };
 
 /*
@@ -49,7 +50,7 @@ static char *incompatible_version[] = {
     "3.0", "3.0.1",
     "3.1", "3.1.1", "3.1.2", "3.1.3",
     "3.5", "3.5.1",
-    "4.9.2",
+    "4.9.3",
     "4.10", "4.10.1",
     "10.0", "11.1", "12.14.20"
 };

Reply to: