I did a little testing of << against my own application and found an  
incompatibility.

<< now copies a node/tree before adding it to another. I had code  
that added the node to a tree and then modified the node. This  
modified the original and not the copy in the parented tree. I don't  
see this as a problem, and the ruby code (in my app) seemed kinda  
dumb to do it that way.

There may be a way to modify the behavior, and I wanted to know if it  
makes sense to do so:

When a node/tree is parented and it is the top node (no other parent)  
and not part of a doc, then it can be installed in place without  
copying, and the original node is modified as it is now a child. If  
it is an intermediate node, then it is always copied.

--or--

since this is variable behavior that may not be obvious, maybe we  
disallow (raise) << for nodes that are part of other trees? This may  
break even more things though.

The copy feature when a node is a non-doc root, could be made  
optional. Either way the behavior changes. Should there be a warning?


Dan

On Sep 4, 2007, at 09:04, Dan Janowski wrote:

> Aah, the << operator. I make a note in the code when I reviewed it
> that there was something amiss. I have fixed it and checked it into
> (the MEM2 branch). The copy_bug.rb and copy_bug2.rb are moved in to
> rwtests and will run as part of 'rake memtests'. They clear now.
> There was an issue in copy_bug2.rb in the xpath find that did not
> yield the hoped result, so I modified it to find the aaa nodes.
>
> Do an svn update on the MEM2 branch to try it (not released).
>
> Dan
>
> On Sep 3, 2007, at 12:24, Ross Bamford wrote:
>
>> Hi,
>>
>> On Fri, 31 Aug 2007 16:53:52 +0100, Dan Janowski <[EMAIL PROTECTED]>
>> wrote:
>>
>>> Ross,
>>>
>>> Try this again with the patch release just announced.
>>>
>>> Dan
>>>
>>
>> Still seeing exactly the same problem. Can anyone else confirm this?
>> Anyway, let me know if you need more information.
>>
>> Cheers,
>> Ross
>>
>>
>>
>>
>>> On Aug 31, 2007, at 08:54, Ross Bamford wrote:
>>>
>>>> On Thu, 30 Aug 2007 14:41:16 +0100, Dan Janowski <[EMAIL PROTECTED]>
>>>> wrote:
>>>>
>>>>> libxml at rubyforge (http://rubyforge.org/projects/libxml/) now
>>>>> has a
>>>>> packaged development release from the MEM2 branch (New Memory
>>>>> Model)
>>>>> http://rubyforge.org/frs/shownotes.php?release_id=14118
>>>>>
>>>>
>>>> Very cool, Dan! :)
>>>>
>>>> On my box though, it seems to break the previous bug tests - both
>>>> tests/copy_bug.rb and tests/copy_bug2.rb bomb out with a doublefree
>>>> error.
>>>> FYI this is compiled from the gem, with GCC 4.1.1 (Red Hat
>>>> 4.1.1-1). I
>>>> included a trace below. Also, running in valgrind shows rather a
>>>> lot of
>>>> memory errors (but no leaks, so looking good there!)
>>>>
>>
>> -- 
>> Ross Bamford - [EMAIL PROTECTED]
>> _______________________________________________
>> libxml-devel mailing list
>> libxml-devel@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/libxml-devel
>
> _______________________________________________
> libxml-devel mailing list
> libxml-devel@rubyforge.org
> http://rubyforge.org/mailman/listinfo/libxml-devel

_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to