From 88277cfbf1cceab46833ba93902ebb9fe1da8133 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Mon, 12 May 2003 17:31:50 +0000 Subject: * generic/tclVar.c (TclObjLookupVar): [Bug 735335] temporary fix, disabling usage of tclNsVarNameType. * tests/var.test (var-15.1): test for [Bug 735335] --- ChangeLog | 6 ++++++ generic/tclVar.c | 14 +++++++++++++- tests/var.test | 16 +++++++++++++++- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ed7890..77051a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-05-12 Miguel Sofer + + * generic/tclVar.c (TclObjLookupVar): [Bug 735335] temporary fix, + disabling usage of tclNsVarNameType. + * tests/var.test (var-15.1): test for [Bug 735335] + 2003-05-10 Zoran Vasiljevic * unix/tclUnixThrd.c: corrected Tcl Bug #723502 diff --git a/generic/tclVar.c b/generic/tclVar.c index f9957fe..a46b2d3 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.69.2.2 2003/04/16 23:31:47 dgp Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.69.2.3 2003/05/12 17:31:51 msofer Exp $ */ #include "tclInt.h" @@ -551,6 +551,17 @@ TclObjLookupVar(interp, part1Ptr, part2, flags, msg, createPart1, createPart2, procPtr->refCount++; part1Ptr->internalRep.twoPtrValue.ptr1 = (VOID *) procPtr; part1Ptr->internalRep.twoPtrValue.ptr2 = (VOID *) index; +#if 0 + /* + * TEMPORARYLY DISABLED tclNsVarNameType + * + * This is a stop-gap fix for [Bug 735335]; it may not address the + * real issue (which I haven't pinned down yet), but it avoids the + * segfault in the test case. + * This optimisation will hopefully be turned back on soon. + * Miguel Sofer, 2003-05-12 + */ + } else if (index > -3) { Namespace *nsPtr; @@ -559,6 +570,7 @@ TclObjLookupVar(interp, part1Ptr, part2, flags, msg, createPart1, createPart2, part1Ptr->typePtr = &tclNsVarNameType; part1Ptr->internalRep.twoPtrValue.ptr1 = (VOID *) nsPtr; part1Ptr->internalRep.twoPtrValue.ptr2 = (VOID *) varPtr; +#endif } else { /* * At least mark part1Ptr as already parsed. diff --git a/tests/var.test b/tests/var.test index c8e57d8..2f0c1df 100644 --- a/tests/var.test +++ b/tests/var.test @@ -14,7 +14,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: var.test,v 1.20.2.1 2003/03/24 00:55:16 msofer Exp $ +# RCS: @(#) $Id: var.test,v 1.20.2.2 2003/05/12 17:31:51 msofer Exp $ # if {[lsearch [namespace children] ::tcltest] == -1} { @@ -680,6 +680,20 @@ test var-14.1 {array names syntax} -body { array names foo bar baz snafu } -returnCodes 1 -match glob -result * +test var-15.1 {segfault in [unset], [Bug 735335]} { + proc A { name } { + upvar $name var + set var $name + } + # + # Note that the variable name has to be + # unused previously for the segfault to + # be triggered. + # + namespace eval test A useSomeUnlikelyNameHere + namespace eval test unset useSomeUnlikelyNameHere +} {} + catch {namespace delete ns} catch {unset arr} catch {unset v} -- cgit v0.12