Tcl Source Code

View Ticket
Login
Ticket UUID: 807243
Title: trace info empty op
Type: Bug Version: obsolete: 8.5a0
Submitter: markgsaye Created on: 2003-09-16 16:31:05
Subsystem: 46. Traces Assigned To: dgp
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2003-10-03 01:08:40
Resolution: Fixed Closed By: dgp
    Closed on: 2003-10-02 18:08:40
Description:
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.
User Comments: dgp added on 2003-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.

dgp added on 2003-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.

dgp added on 2003-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.

dgp added on 2003-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.

dgp added on 2003-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.

dgp added on 2003-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.

Attachments: