Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-03-14
00:30 • Ticket [1675044fff] lreverse shared intrep bug status still Closed with 4 ot... artifact: 1a4a9f6763 user: dgp
2007-03-11
23:56 • Closed ticket [1675044fff]. artifact: 7101890ddf user: dkf
2007-03-06
16:11 • New ticket [1675044fff]. artifact: bf74e19829 user: dgp

lreverse shared intrep bug

Closed / Fixed1675044fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2007-03-06 16:11:28
It is possible for an
unshared "list" Tcl_Obj
to have a List intrep that
it shares with another Tcl_Obj.
This means that checking for
a shared Tcl_Obj isn't enough,
a check for a shared intrep is
also needed before any direct
modifications of the intrep, as
are done around lines 3386-3393.

Would probably be better to shift
the proper functionality that would
rely more on intrep details to
tclListObj.c, and then call some
new routine like TclListObjReverse().

I have not yet been able to construct
a test script to demo the bug.
dkfplain2007-03-11 23:56:04
Logged In: YES 
user_id=79902
Originator: NO

Fixed (though I worry that it was never possible to demonstrate the bug in a test).
dgpplain2007-03-14 00:30:31
Logged In: YES 
user_id=80530
Originator: YES


Here's a test:

testConstraint testobj [llength [info commands testobj]]
test cmdIL-7.7 {lreverse command - shared intrep [Bug 1675044]} -setup {
    teststringobj set 1 {1 2 3}
    testobj convert 1 list
    testobj duplicate 1 2
    variable x [teststringobj get 1]
    variable y [teststringobj get 2]
    testobj freeallvars
    proc K {a b} {return $a}
} -constraints testobj -body {
    lreverse [K $y [unset y]]
    lindex $x 0
} -cleanup {
    unset -nocomplain x y
    rename K {}
} -result 1
Log in (anonymous is fine) to add a comment.