[Pkg-tcltk-commits] r398 - in tcl8.5/trunk/debian: . patches
sgolovan-guest at alioth.debian.org
sgolovan-guest at alioth.debian.org
Mon Nov 26 18:17:57 UTC 2007
Author: sgolovan-guest
Date: 2007-11-26 18:17:56 +0000 (Mon, 26 Nov 2007)
New Revision: 398
Added:
tcl8.5/trunk/debian/patches/stack.diff
Modified:
tcl8.5/trunk/debian/changelog
tcl8.5/trunk/debian/patches/series
tcl8.5/trunk/debian/rules
Log:
[tcl8.5]
Added patch by Miguel Sofer. It fixes incorrect estimation of
stack size.
Modified: tcl8.5/trunk/debian/changelog
===================================================================
--- tcl8.5/trunk/debian/changelog 2007-11-25 11:20:17 UTC (rev 397)
+++ tcl8.5/trunk/debian/changelog 2007-11-26 18:17:56 UTC (rev 398)
@@ -1,8 +1,9 @@
-tcl8.5 (0.b3-2) UNRELEASED; urgency=low
+tcl8.5 (0.b3-2) unstable; urgency=low
- * NOT RELEASED YET
+ * Added a patch by Miguel Sofer which fixes a bug in tclsh with
+ incorrect calculation of thread stack size (closes: #452679).
- -- Sergei Golovan <sgolovan at debian.org> Wed, 21 Nov 2007 19:52:01 +0300
+ -- Sergei Golovan <sgolovan at debian.org> Mon, 26 Nov 2007 20:56:04 +0300
tcl8.5 (0.b3-1) unstable; urgency=low
Modified: tcl8.5/trunk/debian/patches/series
===================================================================
--- tcl8.5/trunk/debian/patches/series 2007-11-25 11:20:17 UTC (rev 397)
+++ tcl8.5/trunk/debian/patches/series 2007-11-26 18:17:56 UTC (rev 398)
@@ -1,3 +1,4 @@
+stack.diff
tcllibrary.diff
tclpackagepath.diff
tclprivate.diff
Added: tcl8.5/trunk/debian/patches/stack.diff
===================================================================
--- tcl8.5/trunk/debian/patches/stack.diff (rev 0)
+++ tcl8.5/trunk/debian/patches/stack.diff 2007-11-26 18:17:56 UTC (rev 398)
@@ -0,0 +1,150 @@
+Patch by Miguel Sofer fixes determining stack size of initial thread.
+
+Index: tcl/generic/tclBasic.c
+===================================================================
+RCS file: /cvsroot/tcl/tcl/generic/tclBasic.c,v
+retrieving revision 1.284
+diff -u -r1.284 tclBasic.c
+--- tcl/generic/tclBasic.c 23 Nov 2007 22:11:31 -0000 1.284
++++ tcl/generic/tclBasic.c 26 Nov 2007 13:45:58 -0000
+@@ -831,6 +831,13 @@
+ Tcl_Panic(Tcl_GetString(Tcl_GetObjResult(interp)));
+ }
+
++ /*
++ * Insure that the stack checking mechanism for this interp is
++ * initialized.
++ */
++
++ TclInterpReady(interp);
++
+ return interp;
+ }
+
+Index: tcl/generic/tclInt.h
+===================================================================
+RCS file: /cvsroot/tcl/tcl/generic/tclInt.h,v
+retrieving revision 1.352
+diff -u -r1.352 tclInt.h
+--- tcl/generic/tclInt.h 23 Nov 2007 15:00:24 -0000 1.352
++++ tcl/generic/tclInt.h 26 Nov 2007 13:45:58 -0000
+@@ -2621,7 +2621,7 @@
+ MODULE_SCOPE void TclpThreadDataKeySet(Tcl_ThreadDataKey *keyPtr,
+ void *data);
+ MODULE_SCOPE void TclpThreadExit(int status);
+-MODULE_SCOPE int TclpThreadGetStackSize(void);
++MODULE_SCOPE size_t TclpThreadGetStackSize(void);
+ MODULE_SCOPE void TclRememberCondition(Tcl_Condition *mutex);
+ MODULE_SCOPE void TclRememberJoinableThread(Tcl_ThreadId id);
+ MODULE_SCOPE void TclRememberMutex(Tcl_Mutex *mutex);
+Index: tcl/unix/tclUnixInit.c
+===================================================================
+RCS file: /cvsroot/tcl/tcl/unix/tclUnixInit.c,v
+retrieving revision 1.80
+diff -u -r1.80 tclUnixInit.c
+--- tcl/unix/tclUnixInit.c 13 Nov 2007 17:13:07 -0000 1.80
++++ tcl/unix/tclUnixInit.c 26 Nov 2007 13:45:58 -0000
+@@ -1145,13 +1145,13 @@
+ struct rlimit rLimit; /* The result from getrlimit(). */
+
+ #ifdef TCL_THREADS
+- rawStackSize = (size_t) TclpThreadGetStackSize();
++ rawStackSize = TclpThreadGetStackSize();
+ if (rawStackSize == (size_t) -1) {
+ /*
+- * Some kind of confirmed error?!
++ * Some kind of confirmed error in TclpThreadGetStackSize?! Fall back
++ * to whatever getrlimit can determine.
+ */
+- STACK_DEBUG(("skipping stack checks with failure\n"));
+- return TCL_BREAK;
++ STACK_DEBUG(("stack checks: TclpThreadGetStackSize failed in \n"));
+ }
+ if (rawStackSize > 0) {
+ goto finalSanityCheck;
+Index: tcl/unix/tclUnixThrd.c
+===================================================================
+RCS file: /cvsroot/tcl/tcl/unix/tclUnixThrd.c,v
+retrieving revision 1.53
+diff -u -r1.53 tclUnixThrd.c
+--- tcl/unix/tclUnixThrd.c 16 Nov 2007 11:17:28 -0000 1.53
++++ tcl/unix/tclUnixThrd.c 26 Nov 2007 13:45:58 -0000
+@@ -216,24 +216,61 @@
+ *----------------------------------------------------------------------
+ */
+
+-int
++size_t
+ TclpThreadGetStackSize(void)
+ {
+ size_t stackSize = 0;
+ #if defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE) && defined(TclpPthreadGetAttrs)
+ pthread_attr_t threadAttr; /* This will hold the thread attributes for
+ * the current thread. */
++ static int initialized = 0;
+
+- if (pthread_attr_init(&threadAttr) != 0) {
+- return -1;
+- }
+- if (TclpPthreadGetAttrs(pthread_self(), &threadAttr) != 0) {
+- pthread_attr_destroy(&threadAttr);
+- return -1;
++ /*
++ * Fix for [Bug 1815573]
++ *
++ * DESCRIPTION:
++ * On linux TclpPthreadGetAttrs (which is pthread_attr_get_np) may return
++ * bogus values on the initial thread. We have a choice: either use the
++ * default thread stack (first branch in the #if below), or return 0 and
++ * let getrlimit do its thing.
++ *
++ * ASSUMPTIONS:
++ * There seems to be no api to determine if we are on the initial
++ * thread. The simple scheme implemented here assumes:
++ * 1. The first Tcl interp to be created lives in the initial thread. If
++ * this assumption is not true, the fix is to call
++ * TclpThreadGetStackSize from the initial thread previous to
++ * creating any Tcl interpreter. In this case, especially if another
++ * Tcl interpreter may be created in the initial thread, it might be
++ * better to enable the second branch in the #if below
++ * 2. There will be no races in creating the first Tcl interp - ie, the
++ * second Tcl interp will be created only after the first call to
++ * Tcl_CreateInterp returns.
++ *
++ * These assumptions are satisfied by tclsh. Embedders may want to check
++ * their validity, and possibly adapt the code on failing to meet them.
++ */
++
++ if (!initialized) {
++ initialized = 1;
++#if 0
++ if (pthread_attr_init(&threadAttr) != 0) {
++ return 0;
++ }
++#else
++ return 0;
++#endif
++ } else {
++ if (TclpPthreadGetAttrs(pthread_self(), &threadAttr) != 0) {
++ pthread_attr_destroy(&threadAttr);
++ return (size_t)-1;
++ }
+ }
++
++
+ if (pthread_attr_getstacksize(&threadAttr, &stackSize) != 0) {
+ pthread_attr_destroy(&threadAttr);
+- return -1;
++ return (size_t)-1;
+ }
+ pthread_attr_destroy(&threadAttr);
+ #elif defined(HAVE_PTHREAD_GET_STACKSIZE_NP)
+@@ -251,7 +288,7 @@
+ * want to try looking at the process accounting limits instead.
+ */
+ #endif
+- return (int) stackSize;
++ return stackSize;
+ }
+ #endif /* TCL_THREADS */
+
Modified: tcl8.5/trunk/debian/rules
===================================================================
--- tcl8.5/trunk/debian/rules 2007-11-25 11:20:17 UTC (rev 397)
+++ tcl8.5/trunk/debian/rules 2007-11-26 18:17:56 UTC (rev 398)
@@ -11,7 +11,7 @@
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS="-g -O0"
else
-# See bug #446335
+# See bug #446335 for -fno-unit-at-a-time
CFLAGS="-g -O2 -fno-unit-at-a-time"
endif
More information about the Pkg-tcltk-commits
mailing list