ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tclxml-users
tclxml-users
[Tclxml-users] Bug in TclDOM 3.1
by Kevin Partin other posts by this author
May 9 2006 2:36PM messages near this date
Re: [Tclxml-users] TCLXML question | [Tclxml-users] working dom example for tclxml3.1 anywhere?
I have found a bug in TclDOM 3.1 under RHEL WS 4 Update 3 and ActiveTcl
8.4.12.0 related to node duplication and memory allocation/deallocation.
The following script demonstrates the error:

package require dom
set fid [open $argv r]
set doc1 [dom::parse [read $fid]]
close $fid
dom::trim $doc1
puts [dom::serialize $doc1]
set root1 [dom::document cget $doc1 -documentElement]
set node [dom::selectNode $root1 child::analysis]
set doc2 [dom::create]
set root2 [dom::document createElement $doc2 maxmin]
dom::element setAttribute $root2 analyses 1
dom::element setAttribute $root2 version [dom::element getAttribute
$root1 version]
dom::node appendChild $root2 $node
puts [dom::serialize $doc2]
dom::destroy $doc1
dom::destroy $doc2
exit


Use the following as a data file:

<?xml version="1.0" encoding="utf-8"?> 
<maxmin analyses="1" version="1.0"> 
  <analysis number="1" items="8" variations="1" ID="NL"> 
    <title> Interface Forces</title>
    <subtitle> Nominal Landing Manifest Configuration</subtitle>
    <label> STS-121 VLA-1 IV&amp;V</label>
  </analysis> 
</maxmin> 

And execute the example as follows:

$ tclsh8.4 test.tcl test.xml
<?xml version="1.0" encoding="utf-8"?> 
<maxmin analyses="1" version="1.0"> <analysis number="1" items="8"
variations="1" ID="NL"> <title>Interface
Forces</title> <subtitle>Nominal Landing Manifest
Configuration</subtitle> <label>STS-121 VLA-1
IV&amp;V</label> </analysis></maxmin>

<?xml version="1.0" encoding="utf-8"?> 
<maxmin analyses="1" version="1.0"> <analysis number="1" items="8"
variations="1" ID="NL"> <title>Interface
Forces</title> <subtitle>Nominal Landing Manifest
Configuration</subtitle> <label>STS-121 VLA-1
IV&amp;V</label> </analysis></maxmin>

*** glibc detected *** free(): invalid pointer: 0x080ca82c ***
Aborted

If you set the environment variable MALLOC_CHECK_=1, you will see that
many attempts are made to free invalid pointers. Experimentation has
isolated the error to appendChild command. As you can see the "new"
document is an exact copy of the original document as it should be. I
suspect that the when the node is removed from the original parent, the
node's document, parent, children, or sibling references are not being
updated properly.

Kevin
-- 
Kevin Partin
(281) 286-8959
mailto:Kevin.Partin@[...].com



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Tclxml-users mailing list
Tclxml-users@[...].net
https://lists.sourceforge.net/lists/listinfo/tclxml-users

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved