Artifacts Associated With Ticket 219422
Ticket change [227074bce4] (rid 130750) by nobody on 2000-10-26 05:12:57:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 6086 Bug Version: 8.4a1 SubmitDate: '2000-08-09' LastModified: '2000-10-25' Severity: MED Status: UnAssn Submitter: techsupp OS: All FixedDate: '2000-10-25' ClosedDate: '2000-10-25' Name: Don Porter ObservedBehavior: Several parts of the Tcl script library and its included packages use the [uplevel] command assuming the built-in command names in the caller's context actually refer to the built-in commands. Since the caller can be in a namespace where commands have been redefined, such assumptions should not be made. The included patch fixes these errors. Patch: Index: library/init.tcl =================================================================== RCS file: /cvsroot/tcl/library/init.tcl,v retrieving revision 1.41 diff -c -r1.41 init.tcl *** init.tcl 2000/05/18 21:37:19 1.41 --- init.tcl 2000/08/09 17:41:17 *************** *** 163,171 **** # then concatenate its arguments onto the end and evaluate it. set cmd [lindex $args 0] ! if {[regexp "^namespace\[ \t\n\]+inscope" $cmd] && [llength $cmd] == 4} { set arglist [lrange $args 1 end] ! set ret [catch {uplevel $cmd $arglist} result] if {$ret == 0} { return $result } else { --- 163,171 ---- # then concatenate its arguments onto the end and evaluate it. set cmd [lindex $args 0] ! if {[regexp "^:*namespace\[ \t\n\]+inscope" $cmd] && [llength $cmd] == 4} { set arglist [lrange $args 1 end] ! set ret [catch {uplevel ::$cmd $arglist} result] if {$ret == 0} { return $result } else { *************** *** 188,194 **** return -code error "self-referential recursion in \"unknown\" for command \"$name\""; } set unknown_pending($name) pending; ! set ret [catch {auto_load $name [uplevel 1 {namespace current}]} msg] unset unknown_pending($name); if {$ret != 0} { append errorInfo "\n (autoloading \"$name\")" --- 188,194 ---- return -code error "self-referential recursion in \"unknown\" for command \"$name\""; } set unknown_pending($name) pending; ! set ret [catch {auto_load $name [uplevel 1 {::namespace current}]} msg] unset unknown_pending($name); if {$ret != 0} { append errorInfo "\n (autoloading \"$name\")" *************** *** 286,292 **** global auto_index auto_oldpath auto_path if {[string length $namespace] == 0} { ! set namespace [uplevel {namespace current}] } set nameList [auto_qualify $cmd $namespace] # workaround non canonical auto_index entries that might be around --- 286,292 ---- global auto_index auto_oldpath auto_path if {[string length $namespace] == 0} { ! set namespace [uplevel {::namespace current}] } set nameList [auto_qualify $cmd $namespace] # workaround non canonical auto_index entries that might be around *************** *** 461,467 **** return } ! set ns [uplevel namespace current] set patternList [auto_qualify $pattern $ns] auto_load_index --- 461,467 ---- return } ! set ns [uplevel ::namespace current] set patternList [auto_qualify $pattern $ns] auto_load_index Index: library/msgcat1.0/msgcat.tcl =================================================================== RCS file: /cvsroot/tcl/library/msgcat1.0/msgcat.tcl,v retrieving revision 1.7 diff -c -r1.7 msgcat.tcl *** msgcat.tcl 2000/07/17 22:25:26 1.7 --- msgcat.tcl 2000/08/09 17:41:18 *************** *** 12,18 **** # # RCS: @(#) $Id: msgcat.tcl,v 1.7 2000/07/17 22:25:26 ericm Exp $ ! package provide msgcat 1.1 namespace eval msgcat { namespace export mc mcset mcmset mclocale mcpreferences mcunknown mcmax --- 12,18 ---- # # RCS: @(#) $Id: msgcat.tcl,v 1.7 2000/07/17 22:25:26 ericm Exp $ ! package provide msgcat 1.2 namespace eval msgcat { namespace export mc mcset mcmset mclocale mcpreferences mcunknown mcmax *************** *** 49,55 **** # Check for the src in each namespace starting from the local and # ending in the global. ! set ns [uplevel {namespace current}] while {$ns != ""} { foreach loc $::msgcat::loclist { --- 49,55 ---- # Check for the src in each namespace starting from the local and # ending in the global. ! set ns [uplevel {::namespace current}] while {$ns != ""} { foreach loc $::msgcat::loclist { *************** *** 136,142 **** incr x set fid [open $langfile "r"] fconfigure $fid -encoding utf-8 ! uplevel [list eval [read $fid]] close $fid } } --- 136,142 ---- incr x set fid [open $langfile "r"] fconfigure $fid -encoding utf-8 ! uplevel [read $fid] close $fid } } *************** *** 161,167 **** set dest $src } ! set ns [uplevel {namespace current}] set ::msgcat::msgs([string tolower $locale],$ns,$src) $dest return $dest --- 161,167 ---- set dest $src } ! set ns [uplevel {::namespace current}] set ::msgcat::msgs([string tolower $locale],$ns,$src) $dest return $dest *************** *** 186,192 **** } set locale [string tolower $locale] ! set ns [uplevel {namespace current}] foreach {src dest} $pairs { set ::msgcat::msgs($locale,$ns,$src) $dest --- 186,192 ---- } set locale [string tolower $locale] ! set ns [uplevel {::namespace current}] foreach {src dest} $pairs { set ::msgcat::msgs($locale,$ns,$src) $dest Index: library/msgcat1.0/pkgIndex.tcl =================================================================== RCS file: /cvsroot/tcl/library/msgcat1.0/pkgIndex.tcl,v retrieving revision 1.2 diff -c -r1.2 pkgIndex.tcl *** pkgIndex.tcl 1999/04/16 00:47:17 1.2 --- pkgIndex.tcl 2000/08/09 17:41:18 *************** *** 1 **** ! package ifneeded msgcat 1.0 [list source [file join $dir msgcat.tcl]] --- 1 ---- ! package ifneeded msgcat 1.2 [list source [file join $dir msgcat.tcl]] Index: library/opt0.4/optparse.tcl =================================================================== RCS file: /cvsroot/tcl/library/opt0.4/optparse.tcl,v retrieving revision 1.4 diff -c -r1.4 optparse.tcl *** optparse.tcl 2000/07/18 21:30:41 1.4 --- optparse.tcl 2000/08/09 17:41:18 *************** *** 10,16 **** # # RCS: @(#) $Id: optparse.tcl,v 1.4 2000/07/18 21:30:41 ericm Exp $ ! package provide opt 0.4.1 namespace eval ::tcl { --- 10,16 ---- # # RCS: @(#) $Id: optparse.tcl,v 1.4 2000/07/18 21:30:41 ericm Exp $ ! package provide opt 0.4.2 namespace eval ::tcl { *************** *** 252,258 **** # (the other will be sets to their default value) # into local variable named "Args". proc ::tcl::OptProc {name desc body} { ! set namespace [uplevel namespace current]; if { ([string match "::*" $name]) || ([string compare $namespace "::"]==0)} { # absolute name or global namespace, name is the key --- 252,258 ---- # (the other will be sets to their default value) # into local variable named "Args". proc ::tcl::OptProc {name desc body} { ! set namespace [uplevel ::namespace current]; if { ([string match "::*" $name]) || ([string compare $namespace "::"]==0)} { # absolute name or global namespace, name is the key *************** *** 262,268 **** set key "${namespace}::${name}"; } OptKeyRegister $desc $key; ! uplevel [list proc $name args "set Args \[::tcl::OptKeyParse $key \$args\]\n$body"]; return $key; } # Check that a argument has been given --- 262,268 ---- set key "${namespace}::${name}"; } OptKeyRegister $desc $key; ! uplevel [list ::proc $name args "set Args \[::tcl::OptKeyParse $key \$args\]\n$body"]; return $key; } # Check that a argument has been given *************** *** 1055,1061 **** set lg [llength $list]; foreach vname $args { if {$i>=$lg} break ! uplevel [list set $vname [lindex $list $i]]; incr i; } return $lg; --- 1055,1061 ---- set lg [llength $list]; foreach vname $args { if {$i>=$lg} break ! uplevel [list ::set $vname [lindex $list $i]]; incr i; } return $lg; Index: library/opt0.4/pkgIndex.tcl =================================================================== RCS file: /cvsroot/tcl/library/opt0.4/pkgIndex.tcl,v retrieving revision 1.2 diff -c -r1.2 pkgIndex.tcl *** pkgIndex.tcl 1999/04/16 00:47:19 1.2 --- pkgIndex.tcl 2000/08/09 17:41:18 *************** *** 8,11 **** # script is sourced, the variable $dir must contain the # full path name of this file's directory. ! package ifneeded opt 0.4.1 [list source [file join $dir optparse.tcl]] --- 8,11 ---- # script is sourced, the variable $dir must contain the # full path name of this file's directory. ! package ifneeded opt 0.4.2 [list source [file join $dir optparse.tcl]] PatchFiles: library/init.tcl library/msgcat1.0/msgcat.tcl library/msgcat1.0/pkgIndex.tcl library/opt0.4/optParse.tcl library/opt0.4/pkgIndex.tcl - foundin initialized to: "obsolete: 8.4a1"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "69. Other"
- title initialized to: "[uplevel] assumes caller cmd definitions"
- type initialized to: "Bug"
Ticket change [9fb31aa5fc] (rid 96683) by dgp on 2000-11-27 22:30:24:
- assignee changed to: "dgp"
- icomment:
The fix committed for Bug 123217 conflicts with the patch associated with Bug 119422. Assigning 119422 to myself to resolve the conflict.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
Ticket change [610b696888] (rid 92176) by dgp on 2000-11-27 23:09:56:
- foundin changed to: "obsolete: 8.4a2"
- icomment:
Patch 102545 is a revised patch suitable for Tcl 8.4a2 plus the changes related to bug 123217.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
Ticket change [3794fdd51f] (rid 107307) by dgp on 2000-12-11 11:21:08:
- closedate changed to: "2000-12-11T04:21:08"
- closer changed to: "dgp"
- icomment:
Fixed by integration of Patch 102545.
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dgp"