From: <no...@so...> - 2001-12-05 21:25:39
|
Bugs item #449893, was opened at 2001-08-10 12:17 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=110894&aid=449893&group_id=10894 Category: 07. Variables Group: None Status: Closed Resolution: Fixed Priority: 8 Submitted By: miguel sofer (msofer) Assigned to: miguel sofer (msofer) Summary: traces on array misbehaving Initial Comment: 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) ---------------------------------------------------------------------- >Comment By: Don Porter (dgp) Date: 2001-12-05 13:24 Message: 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? ---------------------------------------------------------------------- Comment By: miguel sofer (msofer) Date: 2001-12-05 12:45 Message: Logged In: YES user_id=148712 Patch committed to HEAD. ---------------------------------------------------------------------- Comment By: miguel sofer (msofer) Date: 2001-12-01 16:39 Message: 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. ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2001-08-10 12:37 Message: 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 ... ) ---------------------------------------------------------------------- Comment By: miguel sofer (msofer) Date: 2001-08-10 12:23 Message: Logged In: YES user_id=148712 Bug is also present in 8.3.3 and 8.0.5. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=110894&aid=449893&group_id=10894 |