invalid object modification
Closed / Duplicate1374582fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-12-06 16:11:06
(1) run the following script:
proc touch {listValue} {
lset listValue 1 4 5
return $listValue
}
set data [list a [list 1 2 3] b]
puts $data
touch $data
puts $data
(2) you get the expected output:
a {1 2 3} b
a {1 2 3} b
... the proc "touch" has _not_ changed the variable
"data"
(3) now uncomment the first "puts $data" command and
rerun the script
(4) the output is
a {1 7 3} b
BTW: This does _not_ happen with tcl8.5a2.
msoferplain2005-12-06 23:26:28
Logged In: YES
user_id=148712
Something is wrong in your description:
mig@uhu:/home/CVS/tcl_SF_clean/unix$ cat /tmp/test0
proc touch {listValue} {
lset listValue 1 4 5
return $listValue
}
set data [list a [list 1 2 3] b]
puts $data
touch $data
puts $data
mig@uhu:/home/CVS/tcl_SF_clean/unix$ ./tclsh /tmp/test0
a {1 2 3} b
list index out of range
while executing
"lset listValue 1 4 5"
(procedure "touch" line 2)
invoked from within
"touch $data"
(file "/tmp/test0" line 7)
uringplain2005-12-06 23:40:33
Logged In: YES user_id=123371 oops. the command in proc touch must read: lset listValue 1 1 7 sorry;
msoferplain2005-12-06 23:54:07
Logged In: YES
user_id=148712
I cannot reproduce the bug here; am I following your
instructions correctly?
mig@uhu:/home/CVS/tcl_SF_clean/unix$ cat /tmp/test0
proc touch {listValue} {
lset listValue 1 1 7
return $listValue
}
set data [list a [list 1 2 3] b]
puts $data
touch $data
puts $data
mig@uhu:/home/CVS/tcl_SF_clean/unix$ ./tclsh /tmp/test0
a {1 2 3} b
a {1 2 3} b
mig@uhu:/home/CVS/tcl_SF_clean/unix$ cat /tmp/test1
proc touch {listValue} {
lset listValue 1 1 7
return $listValue
}
set data [list a [list 1 2 3] b]
#puts $data
touch $data
puts $data
mig@uhu:/home/CVS/tcl_SF_clean/unix$ ./tclsh /tmp/test1
a {1 2 3} b
uringplain2005-12-07 01:24:53
Logged In: YES user_id=123371 > I cannot reproduce the bug here; am I following your > instructions correctly? Your approach is perfect. On our sites the version of TCL matters. [info patchlevel] should report something >=8.5a3 We can reproduce the bug on: linux - gcc 2.95.x linux - gcc 3.3.x windows VC7 I even checked the "latest" snapshot ( actually it was of yesterday ). If you can't reproduce the bug, what can we do to give you more precise information?
msoferplain2005-12-07 02:19:59
Logged In: YES
user_id=148712
Neither I nor 4 other core maintainers could repro this bug.
Let me give you some questions and homework to try to narrow
it down.
(1) these is obviously self-compiled tclsh; what compile
flags did you use?
(2) Did you run 'make install'? (not necessary if
--disable-shared passed to ./configure)
(3) Is your tclsh linked with any custom C code, or using
extensions?
(4) Are you running this at the command line? Could the
a {1 7 3} b
just be the return value of [touch] being output to the
console? Or do you see this effect when running in batch mode?
(5) Please repro what I did and confirm that you get
different results:
cd path/to/Tcl/unix
make distclean
./configure --disable-shared
make
...
./tclsh path/to/test0
...
./tclsh path/to/test1
uringplain2005-12-07 03:56:20
Logged In: YES user_id=123371 No custom code, pure tcl. Well, it's embarassing, since I've no idea what's going on. I just ran the following script: mkdir /tmp/tcltest cd /tmp/tcltest tar zxvf /archiv/tcl/tcl8.5a3-src.tar.gz cd tcl8.5a3/unix ./configure --disable-shared make ./tclsh /tmp/test0 ./tclsh /tmp/test1 ...and could repro the misbehaviour. i.e. - no custom tclsh - no custom extensions Well, tomorrow I'll go to think about how to improve the documentation of the facts we're observing.
msoferplain2005-12-07 04:44:23
Logged In: YES user_id=148712 AHA! Repro succesfull with 8.5a3! It looks like a bug that has been fixed in HEAD. Could you verify with a current tclsh? My impression is that this is another aspect of Bug #1333036, fixed on 2005-10-20. PS: cvs nightly snapshots at ftp://www.tcl.tk/pub/tcl/nightly-cvs/
uringplain2005-12-07 16:10:54
Logged In: YES user_id=123371 Well, I checked out tcl-20051205 from ftp://www.tcl.tk/pub/tcl/nightly-cvs/ Things are OK now. Thanks a lot.
msofer Closed ticket [1374582fff].
[History diff]2005-12-07 18:46:56
Log in (anonymous is fine) to add a comment.