Artifacts Associated With Ticket 2438181fff
Ticket change [3e91f08799] (rid 121294) by nobody on 2008-12-17 06:53:16:
- assignee initialized to: "dgp"
- cmimetype initialized to: "text/plain"
- comment initialized to:
This script: #----------- set pbody "set comms \[list [info commands]\]" append pbody { set pname [lindex $pstr 1] if {[lsearch -exact $comms $pname]!=-1} { puts "$pname already exists" return } puts "Setting trace on: $pname" trace add execution $pname enter my_report2 puts "Trace set" } #This is an error I made: proc my_report {pstr op} $pbody #This was intended, btw...: #proc my_report {pstr args} $pbody proc my_report2 {commstr args} { set pname [lindex $commstr 0] puts "<DEBUG> $pname" } trace add execution proc leave my_report #Testing: rename gets _gets proc gets {a b} { puts "A new gets" } proc exp {a b} { puts $a puts $b } exp 1 2 gets 5 6 #----------- Correctly reports in tclkit8.4.19: ----- wrong # args: should be "my_report pstr op" while executing "proc gets {a b} { puts "A new gets" }" (file "bug.tcl" line 29) ----- But both tcl 8.5.2 and 8.6a3 report: ----- while executing "proc gets {a b} { puts "A new gets" }" (file "bug.tcl" line 29) ----- As you see, error description is missing. - foundin initialized to: "obsolete: 8.5.5"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "46. Traces"
- title initialized to: "Incorrect error reporting in traces"
- type initialized to: "Bug"
Ticket change [0f79e18897] (rid 94795) by dgp on 2013-01-08 02:01:35:
- priority changed to: "9 Immediate"
Ticket change [0f7c073149] (rid 94797) by pooryorick on 2013-02-12 12:12:57:
- icomment:
Here's a more concise snippet that illustrates the problem, and takes it further by illustrating that the interpreter result for the set command remains in effect and is reported as the error: trace add execution set leave { puts one two three ;#} puts "hmm..." set a hello - login: "pooryorick"
- mimetype: "text/plain"
- username: "pooryorick"
- icomment:
Ticket change [eec8ec10ad] (rid 108875) by pooryorick on 2013-02-13 07:24:05:
- icomment:
Here's a proposed fix and a test: Index: generic/tclTrace.c ================================================================== --- generic/tclTrace.c +++ generic/tclTrace.c @@ -1483,11 +1483,15 @@ lastTracePtr = active.nextTracePtr->nextPtr; } } iPtr->activeCmdTracePtr = active.nextPtr; if (state) { - Tcl_RestoreInterpState(interp, state); + if (traceCode) { + Tcl_DiscardInterpState(state); + } else { + Tcl_RestoreInterpState(interp, state); + } } return traceCode; } @@ -2671,11 +2679,13 @@ if (code == TCL_ERROR) { goto done; } } /* - * an array trace may have caused the variable to exist + * an array trace may have caused the variable to exist. This section + * and the one similar to it after the variable traces below are + * executed addresses bugs like #3603163 and #3599017 */ varPtr2 = TclObjLookupVarEx((Tcl_Interp *) iPtr , Tcl_NewStringObj(part1 ,-1) , Tcl_NewStringObj(part2 ,-1) , flags ,"read" ,/*createPart1*/ 0 ,/*createPart2*/ 0 ,&newArrayPtr Index: tests/trace.test ================================================================== --- tests/trace.test +++ tests/trace.test @@ -2328,10 +2328,22 @@ } -cleanup { namespace delete a rename ::x {} } -result {:: ::} +proc set2 args { + set {*}$args +} + +test trace-22.11.$mode {} { + body {} { + trace add execution set2 leave {puts one two three #;} + } { + set2 a hello + } +} {1 {wrong # args: should be "puts ?-nonewline? ?channelId? string"} {}} + proc factorial {n} { if {$n != 1} { return [expr {$n * [factorial [expr {$n -1 }]]}] } return 1 } - login: "pooryorick"
- mimetype: "text/plain"
- username: "pooryorick"
- icomment:
Ticket change [42b2f35e03] (rid 116428) by pooryorick on 2013-02-13 07:28:40:
- icomment:
oops, the following code chunk isn't part of the fix: @@ -2671,11 +2679,13 @@
- login: "pooryorick"
- mimetype: "text/plain"
- username: "pooryorick"
- icomment:
Ticket change [c619c90492] (rid 121711) by pooryorick on 2013-02-14 13:05:22:
- icomment:
the fix below is also at: https://ynform.org/fossil/tcl/info/45968549a8
- login: "pooryorick"
- mimetype: "text/plain"
- username: "pooryorick"
- icomment:
Ticket change [08902bf007] (rid 89586) by nijtmans on 2013-02-19 17:59:36:
- icomment:
Proposed fix committed to all branches. Given that the functions TclCheckExecutionTraces and TclCheckInterpTraces and were different in the saving/restoring of the interpreter state, there is little doubt to me that this is the right approach. Don, feel free to evaluate.
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [0fe958c2a8] (rid 94876) by nijtmans on 2013-02-19 17:59:37:
- resolution changed to: "Fixed"
Ticket change [096332dbf9] (rid 89711) by nijtmans on 2013-02-19 17:59:50:
- foundin changed to: "obsolete: 8.5.13"
Ticket change [490fdbf3cc] (rid 100003) by dgp on 2013-03-21 20:19:34:
- closedate changed to: "2013-03-21T13:19:34"
- closer changed to: "dgp"
- icomment:
allow_comments - 1
- login: "dgp"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "dgp"