diff options
author | ericm <ericm@noemail.net> | 2000-01-29 00:12:45 (GMT) |
---|---|---|
committer | ericm <ericm@noemail.net> | 2000-01-29 00:12:45 (GMT) |
commit | 69c2a0f5e5d27a57c0d94893373f6f59b9ee3b65 (patch) | |
tree | ee6d1327507899d558998df83d6f9523690a6c56 /library/init.tcl | |
parent | ed8caa8ee956e1c2657c03f8fc7df93992d981aa (diff) | |
download | tcl-69c2a0f5e5d27a57c0d94893373f6f59b9ee3b65.zip tcl-69c2a0f5e5d27a57c0d94893373f6f59b9ee3b65.tar.gz tcl-69c2a0f5e5d27a57c0d94893373f6f59b9ee3b65.tar.bz2 |
* tests/pkg/magicchar2.tcl:
* tests/autoMkindex.test: Test for auto loader fix (bug #2480).
* library/init.tcl: auto_load was using [info commands $name] to
determine if a given command was available; if the command name
had * or [] it, this would fail because info commands uses
glob-style matching. This is fixed. (Bug #2480).
FossilOrigin-Name: 56990efadd02959eb3cf9659c55872101d0fb25b
Diffstat (limited to 'library/init.tcl')
-rw-r--r-- | library/init.tcl | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/library/init.tcl b/library/init.tcl index 1797d50..c5fff21 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -3,7 +3,7 @@ # Default system startup file for Tcl-based applications. Defines # "unknown" procedure and auto-load facilities. # -# RCS: @(#) $Id: init.tcl,v 1.36 2000/01/24 02:30:08 hobbs Exp $ +# RCS: @(#) $Id: init.tcl,v 1.37 2000/01/29 00:12:46 ericm Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -305,11 +305,17 @@ proc auto_load {cmd {namespace {}}} { if {![auto_load_index]} { return 0 } - foreach name $nameList { if {[info exists auto_index($name)]} { uplevel #0 $auto_index($name) - if {[string compare [info commands $name] ""]} { + # There's a couple of ways to look for a command of a given + # name. One is to use + # info commands $name + # Unfortunately, if the name has glob-magic chars in it like * + # or [], it may not match. Since we really want an exact match, + # a better route is to use + # lsearch -exact [info commands] $name + if {[lsearch -exact [info commands] $name] != -1 } { return 1 } } |