Tcl Source Code

View Ticket
Login
Ticket UUID: 1337941
Title: TclCheckExecutionTraces incompatible with Tcl_TraceCommand
Type: Bug Version: obsolete: 8.5a4
Submitter: jhdv Created on: 2005-10-26 00:08:26
Subsystem: 46. Traces Assigned To: dgp
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2005-11-02 07:57:50
Resolution: None Closed By: jhdv
    Closed on: 2005-11-02 00:57:50
Description:
TclCheckExecutionTraces() assumes that
tracePtr->clientData points to a TraceCommandInfo
struct.  This is not the case if, say,
Tcl_TraceCommand() was called to set up a trace from
user code.

Example:  User code calls

Tcl_TraceCommand(interp,"list",TCL_TRACE_RENAME,traceProc,(ClientData)NULL);

and then, from the interpreter:

proc >> args {puts [info level 0]}
trace add execution list enter >>
list

This leads to a segfault in TclCheckExecutionTraces().

A solution that appears to work for me is to make the
assumption above only when tracePtr->traceProc ==
TraceCommandProc.

Patch against CVS version 1.26 of tclTrace.c is attached.
User Comments: dgp added on 2005-11-02 03:19:31:
Logged In: YES 
user_id=80530


Patches committed.
Bug fixed for Tcl 8.4.12 and 8.5a4.

Thanks for the report and the fix!

dgp added on 2005-11-02 02:51:49:

File Added - 154691: 1337941-84.patch

dgp added on 2005-11-02 02:51:26:
Logged In: YES 
user_id=80530


Here's the corresponding
patch for Tcl 8.4 branch

dgp added on 2005-11-02 02:47:10:

File Added - 154690: 1337941.patch

dgp added on 2005-11-02 02:46:41:
Logged In: YES 
user_id=80530


Here's the same patch in the
more customary format.

jhdv added on 2005-10-26 07:08:32:

File Added - 153779: tclTrace.diff

Attachments: