Skip to content
Tcl Source Code History Of Ticket 218982
Login

History Of Ticket 218982

Artifacts Associated With Ticket 218982

  1. Ticket change [cf8645dafd] (rid 112993) by nobody on 2000-10-26 01:08:55:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 3453 Bug
      Version: 8.0p2
      SubmitDate: '1999-11-05'
      LastModified: '2000-01-14'
      Severity: MED
      Status: Released
      Submitter: techsupp
      ChangedBy: ericm
      OS: Solaris
      OSVersion: 2.6
      FixedDate: '2000-01-14'
      FixedInVersion: 8.3
      ClosedDate: '2000-10-25'
      
      
      Name:
      Mark A. Wege
      
      Comments:
      The code also fails under Tcl 7.4.
          
      The code does NOT fail if the array variable is unset in a procedure
      instead of the global scope.  It also doesn't fail if you remove the
      global statement from the showtrace procedure.
      
      ReproducibleScript:
      The following script is a part of some code I've written to help people
      track down problems in their code by setting traces on variables to see
      where their values are being changed.  To execute this, either execute
      tclsh interactively and paste this code into the session, or place the
      code into a file and then execute tclsh with the file as a parameter:
      
      proc showtrace {var ind op} {
          global t
          puts "showtrace: var = $var   ind = $ind   op = $op"
      }
      set t(1) 1
      trace variable t(1) u showtrace
      unset t
      
      ObservedBehavior:
      When the code is executed, tclsh provides the following output and
      then crashes:
          
      showtrace: var = t   ind = 1   op = u
      malformed bucket chain in Tcl_DeleteHashEntry
      Abort (core dumped)
      
      DesiredBehavior:
      Tcl should be able to unset the array variable without crashing.
      
      
      Confirmed in 8.2.2.  Workaround is to explicitly unset t(1)
      first (or foreach over array names). 
      -- 11/10/1999 hobbs
      
      The root of this problem had to do with a failure to protect the array variable from being deleted multiple times, which was implicitly happening in the code shown:  once for the unset, and once when the call stack was popped after finishing the showtrace function.  Of course, free'ing a block of memory twice is never a good thing, and this ultimately led to the core dump.
      
      I fixed the bug by putting protection against this situation in the unset code.  The fix will go into 8.3.
      - eric
      
      -- 01/14/2000 ericm
      
      
      
    4. foundin initialized to: "obsolete: 8.0p2"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "07. Variables"
    10. title initialized to:
      Unsetting array with element traces causes Tcl to abort
      
    11. type initialized to: "Bug"
  2. Ticket change [70793d5242] (rid 100488) by welch on 2000-10-26 08:33:07:

    1. closedate changed to: "2000-10-26T01:33:07"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"