Overview
| Artifact ID: | c9f541ebb8b28eb8c2bde6a2d4bc799656e1a792 |
|---|---|
| Ticket: | 2939073fffffffffffffffffffffffffffffffff
Unset PATTERN unsafe with trace-originated secondary unsets |
| User & Date: | dkf on 2010-02-03 16:46:16 |
Changes
- icomment:
Your patch is still wrong. ;-) More importantly, the whole semantics for how you're going about it is wrong too, and no single-iteration strategy can fix it. To show what I mean, here's a sample session (using the HEAD, but apply any fixes you want...) % trace add variable foo unset {apply {{a b c} {if {$b eq "b"} {global foo; for {set i 0} {$i<100} {incr i} {set foo($i) 1}}}}} % array set foo {b 1 f 1 j 1} % parray foo foo(b) = 1 foo(f) = 1 foo(j) = 1 % array unset foo * % parray foo foo(35) = 1 foo(36) = 1 foo(37) = 1 The fundamental issue is that when an unset trace tinkers with the contents of the array, [array unset]'s semantics go haywire. The only thing I can think of to fix this is to use a multi-step deletion process which first calculates which elements to kill and then nukes them while calling traces. (The confusion about what happens when a trace updates an element that is about to be deleted vs one that has already been deleted is probably an indication that we'll just have to be careful.) I suggest snapshotting (into a C array) at the start is sanest, and lets us avoid problems with the iterator's internal pointer entirely. - login: "dkf"
- mimetype: "text/plain"
- username: "dkf"