Bugs item #16214, was opened at 2007-12-10 10:29
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=16214&group_id=494
Category: memory
Group: v0.5
Status: Open
Resolution: None
Priority: 4
Submitted By: Dan Janowski (danj)
Assigned to: Dan Janowski (danj)
Summary: SEGV when add the cloned/copied node
Initial Comment:
Originally appeared on mail list by optyk (2007-11-27).
segv appears when use clone and copy methods,
what's interesting, with clone segv is thrown in div1.child_add(c)
line (see script)
but when use copy I get it in printf root statement, moreover copy
seems to work wrong only for text nodes, when use 't3' div everything
works fine
I get this error on 0.5.2.0, 0.5.2.1 and 0.5.2.2 (latest svn) version
it looks like fix is required in ruby-libxml code,
BTW. it looks also like ruby_xml_node_copy() in ruby_xml_node.c calls
xmlCopyNode() with wrong attributes, it should be 2 for shallow copy
and 1 for deep copy
-------------------- SCRIPT ---------------------
require 'xml/libxml'
str = <<-STR
<html>
<body>
<div class="textarea" id="t1"
style="STATIC">werwerwerwerwer </div>
<div class="textarea" id="t2" style="STATIC">
Quisque et diam dapibus nisi bibendum blandit.
</div>
<div class="textarea" id="t3" style="STATIC">
<p>aaaaaaaaa</p>
</div>
</body>
</html>
STR
XML::Parser.default_keep_blanks = false
xp = XML::Parser.new
xp.string = str
doc = xp.parse
xpath = "//[EMAIL PROTECTED]'t1']"
div1 = doc.find(xpath).to_a[0]
printf "xxx div1: #{div1}\n"
xpath = "//[EMAIL PROTECTED]'t2']"
div2 = doc.find(xpath).to_a[0]
printf "xxx div2: #{div2}\n"
div2.each do |child|
#c = child.clone
c = child.copy(false)
div1.child_add(c)
end
printf "xxx root: #{doc.root}\n"
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=16214&group_id=494
_______________________________________________
libxml-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/libxml-devel