Re: self contains no data
Nick Wellnhofer <[email protected]> Thu, 13 Sep 2012 15:38:20 +0200
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
On 13/09/2012 15:21, Bruce Miller wrote: > On 09/13/2012 05:49 AM, Nick Wellnhofer wrote: >> On 13/09/2012 00:33, Bruce Miller wrote: >>> I did find something curious. So, XML::LibXML nodes are >>> references to integers. I don't know if those numbers "mean" >>> anything --- in ancient times, they were constant, and >>> you could test node equality by $$a == $$b. >>> At some point (an update related to thread safety?), >>> they're no longer constant, and there's a specific >>> method $a->isSameNode($b). Would be interested in the back-story. >> >> These numbers are raw C pointers. > > Ah, I'd suspected that.... > but they're actually moving around a bit in modern C? interesting... > [If I fetch the "same" nodes from a document at several points > in the program, I'll get different values] That seems strange indeed. I can't remember the internals of XML::LibXML, but maybe it's normal. Different values across program runs are expected because of address space layout randomization. >>> At any rate, printing out the dereferenced integer while walking >>> the tree gives me nice 8-digit numbers like 54824480... >>> until the broken node which has 12 digits (249739024344) >>> and then I get a segfault before any of the Node methods >>> can tell me anything about the node! >> >> The 12-digit number seems to be a corrupted pointer, so the previous >> operation on that node is probably the culprit. Can you tell what the >> previous operation is? Or how the node is created if it's not >> manipulated in any way? > > The structure is roughly: > <Math> > <XMath> > <XMTok> > ... > In this case, the pointer is (or should be) to the <XMath> > and was obtained either by $m->firstChild or $m->childNodes > (where $m is to the <Math>); both fail. > > The children/structure under the <XMath> has been manipulated > and rearranged, rather vigorously. One of those manipulations probably triggers a bug in either libxml2 or the Perl bindings. But without further details it's impossible to know what's going on. Nick _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs