Overview
| Artifact ID: | 231af8abd61aeab69387d879e98c80e311114c97 |
|---|---|
| Ticket: | 218965ffffffffffffffffffffffffffffffffff
empty name array setting failure within namespace procedure |
| User & Date: | nobody on 2000-10-26 01:08:41 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed 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 - foundin changed to: "obsolete: 8.2.1"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "07. Variables"
- title changed to:
empty name array setting failure within namespace procedure
- type changed to: "Bug"