Ticket UUID: | 1444291 | |||
Title: | [::unknown] and alias targets (TCL_EVAL_INVOKE) | |||
Type: | Bug | Version: | obsolete: 8.4.12 | |
Submitter: | dgp | Created on: | 2006-03-06 17:29:07 | |
Subsystem: | 45. Parsing and Eval | Assigned To: | dgp | |
Priority: | 5 Medium | Severity: | ||
Status: | Closed | Last Modified: | 2006-03-07 04:57:22 | |
Resolution: | Fixed | Closed By: | dgp | |
Closed on: | 2006-03-06 21:57:22 | |||
Description: |
Here's a test case illustrating a problem with handling of TCL_EVAL_INVOKE flag value in TclEvalObjvInternal: test parse-8.12 {Tcl_EvalObjv procedure, TCL_EVAL_INVOKE} { set ::auto_index(noSuchCommand) { proc noSuchCommand {} {lappend ::info global} } set ::auto_index(::[string trimleft [namespace current]::test_ns_1::noSuchCo mmand :]) [list \ proc [namespace current]::test_ns_1::noSuchCommand {} { lappend ::info ns }] catch {rename ::noSuchCommand {}} set ::slave [interp create] $::slave alias bar noSuchCommand set ::info {} namespace eval test_ns_1 { $::slave eval bar } namespace delete test_ns_1 interp delete $::slave catch {rename ::noSuchCommand {}} set ::info } global The [::unknown] command is called when Tcl cannot resolve a command name. The default ::unknown proc defined in init.tcl attempts to [auto_load] a command so that the unresolved command name will resolve in future attempts. While performing thi task, the ::unknown proc assumes that the resolution context is given by: [uplevel 1 {::namespace current}] When the command name being resolved is getting eval'd because it is the target of an interp alias, this assumption is not true. TCL_EVAL_INVOKE forces resolution in ::, but swaps back to caller context before ::unknown is called. As the test demos, this can cause the wrong command to be auto-loaded, and evaled. | |||
User Comments: |
dgp added on 2006-03-07 04:57:22:
Logged In: YES user_id=80530 patches committed. dgp added on 2006-03-07 04:48:17: File Added - 169984: 1444291-85.patch dgp added on 2006-03-07 04:48:14: Logged In: YES user_id=80530 corresponding patch for HEAD dgp added on 2006-03-07 04:39:30: File Deleted - 169950: File Added - 169982: 1444291.patch dgp added on 2006-03-07 04:39:28: Logged In: YES user_id=80530 revised patch dgp added on 2006-03-07 01:08:27: File Added - 169950: 1444291.patch dgp added on 2006-03-07 01:08:26: Logged In: YES user_id=80530 Attached patch fixes core-8-4-branch, while simplifying TEOvI at the same time. |