Tcl Source Code

Artifact [151d32ee46]
Login

Artifact 151d32ee462d1b965de24f1e54ca04f4e8493321:

Attachment "2802881-test.patch" to ticket [2802881fff] added by dgp 2009-06-13 21:10:11.
? 2603158.patch
? 2802881-test.patch
? 2802881.patch
? bump.patch
? debug
? sift
? thread
? generic/expand1.patch
? generic/self.patch
? unix/autom4te.cache
? unix/cat
? unix/dltest.marker
? unix/longfile
? unix/output
? unix/pipe
? unix/script
? unix/stdout
? unix/test1
? unix/test2
? unix/test3
? win/autom4te.cache
Index: generic/tclCompile.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCompile.c,v
retrieving revision 1.146.2.6
diff -u -r1.146.2.6 tclCompile.c
--- generic/tclCompile.c	25 Jul 2008 20:30:44 -0000	1.146.2.6
+++ generic/tclCompile.c	13 Jun 2009 14:09:49 -0000
@@ -870,6 +870,7 @@
     envPtr->source = stringPtr;
     envPtr->numSrcBytes = numBytes;
     envPtr->procPtr = iPtr->compiledProcPtr;
+    iPtr->compiledProcPtr = NULL;
     envPtr->numCommands = 0;
     envPtr->exceptDepth = 0;
     envPtr->maxExceptDepth = 0;
Index: generic/tclProc.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclProc.c,v
retrieving revision 1.139.2.4
diff -u -r1.139.2.4 tclProc.c
--- generic/tclProc.c	19 Oct 2008 19:54:22 -0000	1.139.2.4
+++ generic/tclProc.c	13 Jun 2009 14:09:50 -0000
@@ -1891,7 +1891,6 @@
     Interp *iPtr = (Interp *) interp;
     int i;
     Tcl_CallFrame *framePtr;
-    Proc *saveProcPtr;
     ByteCode *codePtr = bodyPtr->internalRep.otherValuePtr;
     CompiledLocal *localPtr;
 
@@ -1961,8 +1960,6 @@
  	 *   appropriate class context.
  	 */
 
- 	saveProcPtr = iPtr->compiledProcPtr;
-
 	if (procPtrPtr != NULL && procPtr->refCount > 1) {
 	    Tcl_Command token;
 	    Tcl_CmdInfo info;
@@ -2045,7 +2042,6 @@
 	(void) tclByteCodeType.setFromAnyProc(interp, bodyPtr);
 	iPtr->invokeCmdFramePtr = NULL;
 	TclPopStackFrame(interp);
- 	iPtr->compiledProcPtr = saveProcPtr;
     } else if (codePtr->nsEpoch != nsPtr->resolverEpoch) {
 	/*
 	 * The resolver epoch has changed, but we only need to invalidate the
Index: tests/execute.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/execute.test,v
retrieving revision 1.27.2.1
diff -u -r1.27.2.1 execute.test
--- tests/execute.test	4 Aug 2008 04:48:16 -0000	1.27.2.1
+++ tests/execute.test	13 Jun 2009 14:09:50 -0000
@@ -972,6 +972,19 @@
     set result
 } SUCCESS
 
+test execute-10.1 {Bug 2802881} -setup {
+    interp create slave
+} -body {
+    # If [Bug 2802881] is not fixed, this will segfault
+    slave eval {
+	trace add variable ::errorInfo write {expr {$foo} ;#}
+	proc demo {} {a {}{}}
+	demo
+    }
+} -cleanup {
+    interp delete slave
+} -returnCodes error -match glob -result *
+
 # cleanup
 if {[info commands testobj] != {}} {
    testobj freeallvars