Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-03-07
04:57 • Closed ticket [1444291fff]: :unknown and alias targets (TCL_EVAL_INVOKE) ... artifact: 16c7e2e43d user: dgp
04:48 • Ticket [1444291fff]: 4 changes artifact: 704b781ea9 user: dgp
04:48 • Ticket [1444291fff]: 4 changes artifact: a9ba6d446d user: dgp
04:48 • Add attachment 1444291-85.patch to ticket [1444291fff] artifact: 23756fcc38 user: dgp
04:39 • Ticket [1444291fff] :unknown and alias targets (TCL_EVAL_INVOKE) status s... artifact: 47c78408a0 user: dgp
04:39 • Add attachment 1444291.patch to ticket [1444291fff] artifact: 91e664171e user: dgp
04:39 • Ticket [1444291fff] :unknown and alias targets (TCL_EVAL_INVOKE) status s... artifact: b9222725ea user: dgp
01:08 • Ticket [1444291fff]: 4 changes artifact: 2aae6670a8 user: dgp
01:08 • Ticket [1444291fff]: 4 changes artifact: 99c4df07f1 user: dgp
2006-03-06
17:29 • New ticket [1444291fff]. artifact: 76f1496e16 user: dgp

[::unknown] and alias targets (TCL_EVAL_INVOKE)

Closed / Fixed1444291fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2006-03-06 17:29:07
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.
dgpplain2006-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.
dgpplain2006-03-07 01:08:27
File Added - 169950: 1444291.patch
dgpplain2006-03-07 04:39:28
Logged In: YES 
user_id=80530

revised patch
dgpplain2006-03-07 04:39:30
File Deleted - 169950: 



File Added - 169982: 1444291.patch
dgpplain2006-03-07 04:48:14
Logged In: YES 
user_id=80530


corresponding patch for HEAD
dgpplain2006-03-07 04:48:17
File Added - 169984: 1444291-85.patch
dgpplain2006-03-07 04:57:22
Logged In: YES 
user_id=80530

patches committed.
Log in (anonymous is fine) to add a comment.

Attachments: