Skip to content
Tcl Source Code History Of Ticket 218965ffffffffff
Login

History Of Ticket 218965ffffffffff

Artifacts Associated With Ticket 218965ffffffffff

  1. Ticket change [231af8abd6] (rid 130861) by nobody on 2000-10-26 01:08:41:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 3339 Bug
      Version: 8.2.1
      SubmitDate: '1999-11-05'
      LastModified: '1999-12-09'
      Severity: MED
      Status: Released
      Submitter: techsupp
      ChangedBy: hobbs
      RelatedBugIDs: 2551
      OS: Linux-Red Hat
      FixedDate: '1999-12-09'
      FixedInVersion: 8.3b1
      ClosedDate: '2000-10-25'
      
      
      Name:
      Jean-Luc Fontaine
      
      Comments:
      bug also present in 8.0 and 8.1 releases
      
      ReproducibleScript:
      namespace eval n {
              proc p {} {
                  variable {}
                  set (0) 0
                  set (1) 1
                  set n 2
                  set ($n) 2
                  set ($n,foo) 2
              }
              p
              parray {}
          }
      
      ObservedBehavior:
      ouput:
          (0)     = 0
          (2,foo) = 2
      
      DesiredBehavior:
      output:
          (0)     = 0
          (1)     = 1
          (2)     = 2
          (2,foo) = 2
      
      
      
      More info from Jean-Luc:
      
      I found what happened in tclCompile.c, TclFindCompiledLocal(): 
      
      ...
      for (i = 0;  i < localCt;  i++) {
        if (!TclIsVarTemporary(localPtr)) {
          char *localName = localPtr->name;
          if ((name[0] == localName[0])
            && (nameBytes == localPtr->nameLength)
            && (strncmp(name, localName, (unsigned) nameBytes) == 0)) {
              return i;
          }
        }
        localPtr = localPtr->nextPtr;
      }
      ...
      For the following Tcl source code: 
      namespace eval n {proc p {} {variable {}; set (a) 0; set (b) 1}}
      if we look at what happens at the following line: 
          if ((name[0] == localName[0])
      For (a), name is "(a) 0; set (b) 1" and we never get there, which is normal since the {} array is not yet allocated. For (b), name is "(b) 1" and since localName is "" (empty name array allocated at the (a) occurence), comparing the first characters ('(' and '\0') is wrong. The fix consists in removing the test on the first byte. 
      
      -----
      
      This is correct, that slight opt breaks the {} array name case,
      and is covered by the strncmp. 
      -- 12/09/1999 hobbs
      
      
      
    4. foundin initialized to: "obsolete: 8.2.1"
    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:
      empty name array setting failure within namespace procedure
      
    11. type initialized to: "Bug"
  2. Ticket change [863539647a] (rid 131461) by welch on 2000-10-26 08:32:16:

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