Skip to content
Tcl Source Code View Ticket
Login

View Ticket

trace info empty op

Closed / Fixed807243ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2003-09-16 16:31:05
Consider:

proc test {args} {}

proc trace:command {oldName newName op} {
  puts "proc trace:command \[$oldName\] \[$newName\]
\[$op\]"
}

proc trace:execution {string op} {
   puts "proc trace:execution \[$string\] \[$op\]"
}

trace add command  ::test delete [list trace:command]
trace add execution ::test enter [list trace:execution]


Now doing:
% trace info command ::test
{delete trace:command} {{} trace:execution}

% trace info execution ::test
{{} trace:command} {enter trace:execution}

Note how the execution trace adds to the 'trace info
command' with an empty 'op', and vice versa.
dgpplain2003-09-24 07:09:09
Logged In: YES 
user_id=80530


Both [t i command] and [t i execution]
call on Tcl_CommandTraceInfo()
to introspect the traces, even though
Tcl_CTI is documented only to return
information on "command" traces,
not "execution" ones.

For 8.4.x, it seems the bogus entries
could be filtered out of the returned
lists.

For 8.5, these separate trace sets
should be separated in their
implementation as well.
dgpplain2003-09-24 08:14:57
Logged In: YES 
user_id=80530


Here's a test case inspired by the report:

test trace-31.1 {command and execution traces shared struct} {
    proc foo {} {}
    trace add command foo delete foo
    trace add execution foo enter foo
    set result [trace info command foo]
    rename foo {}
    set result
} [list [list delete foo]]


This test causes a segfault.

There are bigger problems here.
dgpplain2003-09-24 08:59:30
Logged In: YES 
user_id=80530


Ok, that's a separate problem.
Let's not confuse these matters.

That segfault is apparently due
to an attempt to trigger a delete
trace that calls the traced command.
That's pretty tricky; perhaps not
too surprising it's broken.
dgpplain2003-09-24 09:11:08
File Added - 62331: 807243.patch

Logged In: YES 
user_id=80530

here's an 8.4 patch just for
the reported problem.
dgpplain2003-09-24 09:17:10
Logged In: YES 
user_id=80530


Patch committed for 8.4.5

Bug still open on 8.5 branch
pending a better fix.
dgpplain2003-10-03 01:08:40
Logged In: YES 
user_id=80530

commiting same fix to HEAD.

Cleaner fixes will be a long time
in coming.  Test suite entry
should stop us making the same
bug again.
Log in (anonymous is fine) to add a comment.

Attachments: