diff options
author | dgp <dgp@users.sourceforge.net> | 2003-09-23 04:49:10 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2003-09-23 04:49:10 (GMT) |
commit | c9ac0de4ba3254bc18fb2222cf61c5e40813fd97 (patch) | |
tree | a2ddc64b530eed2523d5e4b60bdd60c41977146e | |
parent | 20f6ea1d4ca61eeffeec277217f46727bb825841 (diff) | |
download | tcl-c9ac0de4ba3254bc18fb2222cf61c5e40813fd97.zip tcl-c9ac0de4ba3254bc18fb2222cf61c5e40813fd97.tar.gz tcl-c9ac0de4ba3254bc18fb2222cf61c5e40813fd97.tar.bz2 |
* library/init.tcl (auto_load, auto_import): Expanded Eric Melski's
2000-01-28 fix for [Bug 218871] to all potentially troubled uses of
[info commands] on input data, where glob-special characters could
cause problems.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | library/init.tcl | 33 |
2 files changed, 24 insertions, 16 deletions
@@ -1,3 +1,10 @@ +2003-09-23 Don Porter <dgp@users.sourceforge.net> + + * library/init.tcl (auto_load, auto_import): Expanded Eric Melski's + 2000-01-28 fix for [Bug 218871] to all potentially troubled uses of + [info commands] on input data, where glob-special characters could + cause problems. + 2003-09-19 Miguel Sofer <msofer@users.sf.net> * generic/tclExecute.c: adding (DE)CACHE_STACK_INFO() pairs to diff --git a/library/init.tcl b/library/init.tcl index 8ad26f9..b1d2b09 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.55.2.1 2003/07/18 23:35:39 dgp Exp $ +# RCS: @(#) $Id: init.tcl,v 1.55.2.2 2003/09/23 04:49:12 dgp Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -342,8 +342,17 @@ proc auto_load {cmd {namespace {}}} { lappend nameList $cmd foreach name $nameList { if {[info exists auto_index($name)]} { - uplevel #0 $auto_index($name) - return [expr {[info commands $name] != ""}] + namespace eval :: $auto_index($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. For our purposes here, a better + # route is to use + # namespace which -command $name + if {[namespace which -command $name] ne ""} { + return 1 + } } } if {![info exists auto_path]} { @@ -355,15 +364,8 @@ proc auto_load {cmd {namespace {}}} { } foreach name $nameList { if {[info exists auto_index($name)]} { - uplevel #0 $auto_index($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. For our purposes here, a better - # route is to use - # namespace which -command $name - if { ![string equal [namespace which -command $name] ""] } { + namespace eval :: $auto_index($name) + if {[namespace which -command $name] ne ""} { return 1 } } @@ -516,10 +518,9 @@ proc auto_import {pattern} { foreach pattern $patternList { foreach name [array names auto_index $pattern] { - if {[string equal "" [info commands $name]] - && [string equal [namespace qualifiers $pattern] \ - [namespace qualifiers $name]]} { - uplevel #0 $auto_index($name) + if {([namespace which -command $name] eq "") + && ([namespace qualifiers $pattern] eq [namespace qualifiers $name])} { + namespace eval :: $auto_index($name) } } } |