From 658bfb282ce6fcba3cdf53d7448e7fa3e3fa05ac Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 24 Mar 2004 21:54:10 +0000 Subject: Silly bug found originally by Damon Courtney. [922752] --- ChangeLog | 6 ++++++ generic/tclNamesp.c | 4 ++-- tests/namespace.test | 9 ++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e44c623..1ecf806 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-03-24 Donal K. Fellows + + * generic/tclNamesp.c (NsEnsembleImplementationCmd): Fix messed up + handling of strncmp result which just happened to work in some + libc implementations. [Bug 922752] + 2004-03-23 Donal K. Fellows * doc/StringObj.3: Inverted the sense of the documentation of how diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index a4c4f2e..ded1f96 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -21,7 +21,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNamesp.c,v 1.36 2004/03/18 18:54:58 rmax Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.37 2004/03/24 21:54:32 dkf Exp $ */ #include "tclInt.h" @@ -4880,7 +4880,7 @@ NsEnsembleImplementationCmd(clientData, interp, objc, objv) goto unknownOrAmbiguousSubcommand; } fullName = ensemblePtr->subcommandArrayPtr[i]; - } else if (cmp == 1) { + } else if (cmp < 0) { /* * Because we are searching a sorted table, we can now * stop searching because we have gone past anything diff --git a/tests/namespace.test b/tests/namespace.test index 72a2f33..4eb2854 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: namespace.test,v 1.23 2003/11/14 20:44:46 dgp Exp $ +# RCS: @(#) $Id: namespace.test,v 1.24 2004/03/24 21:54:32 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -1389,6 +1389,13 @@ test namespace-44.4 {ensemble: errors} { list [catch {namespace ensemble create -map {x {}}} msg] $msg } } {1 {ensemble subcommand implementations must be non-empty lists}} +test namespace-44.5 {ensemble: errors} -setup { + namespace ensemble create -command foobar -subcommands {foobarcget foobarconfigure} +} -body { + foobar foobarcon +} -cleanup { + rename foobar {} +} -returnCodes error -result {invalid command name "::foobarconfigure"} test namespace-45.1 {ensemble: introspection} { namespace eval ns { -- cgit v0.12