Skip to content
Tcl Source Code History Of Ticket 2438181fffffffffffffffffffffffffffffffff
Login

History Of Ticket 2438181fffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 2438181fffffffffffffffffffffffffffffffff

  1. Ticket change [3e91f08799] (rid 121294) by nobody on 2008-12-17 06:53:16:

    1. assignee initialized to: "dgp"
    2. cmimetype initialized to: "text/plain"
    3. 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.
      
      
      
      
      
      
    4. foundin initialized to: "obsolete: 8.5.5"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "nobody"
    10. subsystem initialized to: "46. Traces"
    11. title initialized to: "Incorrect error reporting in traces"
    12. type initialized to: "Bug"
  2. Ticket change [0f79e18897] (rid 94795) by dgp on 2013-01-08 02:01:35:

    1. priority changed to: "9 Immediate"
  3. Ticket change [0f7c073149] (rid 94797) by pooryorick on 2013-02-12 12:12:57:

    1. 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 
      
      
      
    2. login: "pooryorick"
    3. mimetype: "text/plain"
    4. username: "pooryorick"
  4. Ticket change [eec8ec10ad] (rid 108875) by pooryorick on 2013-02-13 07:24:05:

    1. 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
       }
      
      
      
    2. login: "pooryorick"
    3. mimetype: "text/plain"
    4. username: "pooryorick"
  5. Ticket change [42b2f35e03] (rid 116428) by pooryorick on 2013-02-13 07:28:40:

    1. icomment:
      oops, the following code chunk isn't part of the fix:
      
       @@ -2671,11 +2679,13 @@
      
      
    2. login: "pooryorick"
    3. mimetype: "text/plain"
    4. username: "pooryorick"
  6. Ticket change [c619c90492] (rid 121711) by pooryorick on 2013-02-14 13:05:22:

    1. icomment:
      the fix below is also at:
      
      https://ynform.org/fossil/tcl/info/45968549a8
      
      
    2. login: "pooryorick"
    3. mimetype: "text/plain"
    4. username: "pooryorick"
  7. Ticket change [08902bf007] (rid 89586) by nijtmans on 2013-02-19 17:59:36:

    1. 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.
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  8. Ticket change [0fe958c2a8] (rid 94876) by nijtmans on 2013-02-19 17:59:37:

    1. resolution changed to: "Fixed"
  9. Ticket change [096332dbf9] (rid 89711) by nijtmans on 2013-02-19 17:59:50:

    1. foundin changed to: "obsolete: 8.5.13"
  10. Ticket change [490fdbf3cc] (rid 100003) by dgp on 2013-03-21 20:19:34:

    1. closedate changed to: "2013-03-21T13:19:34"
    2. closer changed to: "dgp"
    3. icomment:
      
      
      allow_comments - 1
      
      
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "dgp"