Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 76f1496e1612b6ed9247262f17c99a7ea485116c
Ticket: 1444291fffffffffffffffffffffffffffffffff
[::unknown] and alias targets (TCL_EVAL_INVOKE)
User & Date: dgp on 2006-03-06 17:29:07
Changes

  1. assignee changed to: "dgp"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    
    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.
    
    
    
    
    
  4. foundin changed to: "obsolete: 8.4.12"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "dgp"
  9. subsystem changed to: "45. Parsing and Eval"
  10. title changed to: "[::unknown] and alias targets (TCL_EVAL_INVOKE)"
  11. type changed to: "Bug"