|
2004-03-28
| ||
| 07:59 | • Ticket [449893ffff] traces on array misbehaving status still Closed with 2 o... artifact: 34474c56f5 user: msofer | |
| 07:59 | • Closed ticket [449893ffff]. artifact: 509c9b7b31 user: msofer | |
| 07:43 | • Ticket [449893ffff]: 1 change artifact: e1604e49f1 user: msofer | |
|
2003-11-13
| ||
| 08:32 | • Ticket [449893ffff]: 1 change artifact: 9dd75aeb28 user: dgp | |
|
2003-10-07
| ||
| 22:20 | • Ticket [449893ffff]: 1 change artifact: 16e88ccea9 user: dgp | |
| 22:20 | • Ticket [449893ffff]: 1 change artifact: 72110bf735 user: dgp | |
|
2003-10-03
| ||
| 06:23 | • Ticket [449893ffff]: 1 change artifact: 470497dadd user: dgp | |
|
2003-06-26
| ||
| 22:47 | • Ticket [449893ffff]: 1 change artifact: 2dcef535d7 user: dgp | |
| 17:31 | • Ticket [449893ffff]: 1 change artifact: 7b48ba606c user: dkf | |
|
2001-12-06
| ||
| 04:39 | • Open ticket [449893ffff]. artifact: 137b66bfa4 user: msofer | |
| 04:24 | • Ticket [449893ffff]: 6 changes artifact: 60d27c49e9 user: dgp | |
| 03:45 | • Closed ticket [449893ffff]. artifact: 709dbaac02 user: msofer | |
|
2001-12-02
| ||
| 07:39 | • Ticket [449893ffff]: 4 changes artifact: 9d5fe46d3d user: msofer | |
| 07:39 | • Add attachment arrayGet.patch to ticket [449893ffff] artifact: c2b66783f6 user: msofer | |
|
2001-08-11
| ||
| 02:37 | • Ticket [449893ffff] traces on array misbehaving status still Open with 4 oth... artifact: 92d8fc46fa user: dgp | |
| 02:23 | • Ticket [449893ffff]: 4 changes artifact: fa96b05e07 user: msofer | |
|
2001-08-10
| ||
| 19:17 | • New ticket [449893ffff]. artifact: b9a0b02fe2 user: msofer | |
traces on array misbehaving
Closed / Fixed449893ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 23 years ago
Descriptionplain2001-08-10 19:17:05
This shouldn't core-dump!
% info patch
8.4a4
% set x(bar) 0
0
% trace variable x r {set x(foo) 1 ;#}
% trace variable x r {unset -nocomplain x(bar) ;#}
% trace vinfo x
{r {unset -nocomplain x(bar) ;#}} {r {set x(foo) 1 ;#}}
% array get
x
": no such element in array
% array get x
Segmentation fault (core dumped)
msoferplain2001-08-11 02:23:22
Logged In: YES user_id=148712 Bug is also present in 8.3.3 and 8.0.5.
dgpplain2001-08-11 02:37:36
Logged In: YES
user_id=80530
Note, a very similar script causes a segfault
in Tcl 8.3.3. (Change [unset -nocomplain ...]
to [catch {unset ... )
msoferplain2001-12-02 07:39:39
File Added - 14049: arrayGet.patch
Logged In: YES
user_id=148712
It is difficult to define what the correct behaviour of
[array get]
should be when there are read traces that modify the array
structure.
In discussions on the Tcl'ers Chat with Kevin Kenny and
Don Porter we agreed that a (the only ?) reasonable
behaviour
is given by
proc array-get { aName } {
set result [list]
upvar 1 $aName array
foreach s [array names array] {
if { [info exists array($s)] } {
# because a trace could have deleted it
lappend result $s $array($s)
}
}
return $result
}
The enclosed patch implements this behaviour and adds three
tests
for it. These tests cause illegal memory behaviour without
the patch
to tclVar.c - an access to a previously disposed Tcl_Obj is
detected
by TCL_MEM_DEBUG.
msoferplain2001-12-06 03:45:09
Logged In: YES user_id=148712 Patch committed to HEAD.
dgpplain2001-12-06 04:24:59
Logged In: YES user_id=80530 the patch included no doc changes. Is there a best place to document the particular behavior? In the [array get] docs, perhaps?
msoferplain2001-12-06 04:39:02
Logged In: YES
user_id=148712
Re docs: or with [trace]? Or both?
It is a really something that is relevant to the interplay
between [array get] and [trace] - when there are read traces
on an array that either add or remove an element of the
array.
I'm also not 100% happy with the error message when the
trace unsets the whole array (see test trace-1.13 ): should
it rather return {} and no error as does [array get
nonExistingArray] ?
Reopening the ticket, with lower priority now that the
segfault is gone ...
dkf Ticket [449893ffff]: 1 change
[History diff]2003-06-26 17:31:21
dgp Ticket [449893ffff]: 1 change
[History diff]2003-06-26 22:47:07
dgp Ticket [449893ffff]: 1 change
[History diff]2003-10-03 06:23:38
dgp Ticket [449893ffff]: 1 change
[History diff]2003-10-07 22:20:40
dgp Ticket [449893ffff]: 1 change
[History diff]2003-10-07 22:20:46
dgp Ticket [449893ffff]: 1 change
[History diff]2003-11-13 08:32:14
msofer Ticket [449893ffff]: 1 change
[History diff]2004-03-28 07:43:31
msoferplain2004-03-28 07:59:43
Logged In: YES user_id=148712 Docs added to array.n
msofer Ticket [449893ffff]: 2 changes
[History diff]2004-03-28 07:59:44
Log in (anonymous is fine) to add a comment.
Attachments:
- arrayGet.patch [download] added by msofer on 2001-12-02 07:39:39. [details]