From 6458b68fec3fa182b9c76b77efd135f7a2924b93 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 9 Nov 2001 23:06:04 +0000 Subject: * tests/var.test: * generic/tclVar.c: Corrected bug in [global] when dealing with variable names matching :*. [Bug 480176] --- ChangeLog | 6 ++++++ generic/tclVar.c | 4 ++-- tests/var.test | 12 +++++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5478387..e608ba6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-11-09 Don Porter + + * tests/var.test: + * generic/tclVar.c: Corrected bug in [global] when dealing + with variable names matching :*. [Bug 480176] + 2001-11-08 Mo DeJong Fixup stack size under OSF1. [Tcl patch 474790] diff --git a/generic/tclVar.c b/generic/tclVar.c index d3e2c4b..d4290d0 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -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: tclVar.c,v 1.38 2001/09/27 20:32:35 dgp Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.39 2001/11/09 23:06:04 dgp Exp $ */ #include "tclInt.h" @@ -4010,7 +4010,7 @@ Tcl_GlobalObjCmd(dummy, interp, objc, objv) while ((tail > varName) && ((*tail != ':') || (*(tail-1) != ':'))) { tail--; } - if (*tail == ':') { + if ((*tail == ':') && (tail > varName)) { tail++; } diff --git a/tests/var.test b/tests/var.test index cb2d093..916b9b4 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.17 2001/07/04 00:55:08 hobbs Exp $ +# RCS: @(#) $Id: var.test,v 1.18 2001/11/09 23:06:04 dgp Exp $ # if {[lsearch [namespace children] ::tcltest] == -1} { @@ -327,6 +327,16 @@ test var-6.3 {Tcl_GlobalObjCmd, variable named {} qualified by a namespace name} } p } {24} +test var-6.4 {Tcl_GlobalObjCmd, variable name matching :*} { + # Test for Tcl Bug 480176 + set :v broken + proc p {} { + global :v + set :v fixed + } + p + set :v +} {fixed} test var-7.1 {Tcl_VariableObjCmd, create and initialize one new ns variable} { catch {namespace delete test_ns_var} -- cgit v0.12