Tcl Source Code

View Ticket
Login
2026-10-17
06:37 • Ticket [fc88534d38] duplicate trace with namespace exported proc status stil... artifact: dc56b58c85 user: serhiy.storchaka
06:37
Fix [fc88534d38]: step and interpreter traces saw an imported command twice, because InvokeImportedN... check-in: c8c14f3e58 user: serhiy.storchaka tags: imported-cmd-step-traces
2019-11-29
08:55 • New ticket [fc88534d38] duplicate trace with namespace exported proc. artifact: 077e6bde02 user: anonymous

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.