Tcl Source Code

View Ticket
Login
Ticket UUID: fc88534d38e4136a22e58c8b7e8cd257773ae8e
Title: duplicate trace with namespace exported proc
Type: Bug Created on: 2019-11-29 08:55:31
Submitter: anonymous Assigned to: nobody
Subsystem: 46. Traces Severity: Minor
Priority: 5 Medium Last modified: 2026-10-17 06:37:55
Status: Open Closed by: nobody
Resolution: None Closed on:
Version: 8.6.18, 9.0.5, 9.1.0
Description:
In the following test case, the procedure test is always sent a duplicate trace if that proc was exported out of the namespace, vs. when called with the full name. 

namespace eval Counter {
    namespace export test 
    proc test {} {
       return
    }
}

proc tracer {args} {
	puts "tracer: `$args`"
}

proc main {args} {
	test
	puts ""
	::Counter::test
}

namespace import Counter::test 

trace add execution main enterstep tracer
main
User Comments:
serhiy.storchaka added on 2026-10-17 06:37:55:

Regression since 8.6 (8.5 traces the call once): InvokeImportedNRCmd() re-dispatches to the real command through TclNREvalObjv(), which runs the step and interpreter traces a second time. Proposed fix in branch imported-cmd-step-traces: an internal flag skips the interpreter traces for that re-dispatch; execution traces on the real command still fire. Tests trace-41.1 and trace-41.2.