本当は怖いHPC

HPC屋の趣味&実益ブログ

[ruby] libxml-rubyのSEGVにパッチを送ったけど直せていなかった

libxml-rubyがSEGVする問題を修正するパッチを投げたんだけど、作者に吟味してもらったところ直せていなかった。ちょっと残念。

keisuke fukuda submitted a patch for this problem which I have
carefully examined. The given patcch fixes the problem by creating
an unintended consequence, by always copying text nodes. However,
the real cause of the problem is more subtle and has to do with
merging of text nodes when the parent node already has an associated
text node. Since we cannot have a text node that is mapped into
ruby simply disappear, they do always need to be copied. However,
a few additional conditions needed to be handled.

http://rubyforge.org/tracker/?func=detail&atid=1971&aid=16214&group_id=494

テキストのみのノードをコピーしてAddChildするとSEGVするという問題。
まぁ普通の使い方をしてればまず引っかかることは無いはずなんだけど、直せなかったのは悔しい。もう一度トライしようか。

個人的には、前にもちょっと書いたけど、libxmlの関数の仕様が悪いせいだと思う。AddChildという、ノードに子要素を追加する関数なんだけど、追加される子要素が、条件によってオブジェクトが開放されたり開放されなかったりする。

なので、非常に使いにくいというか、悪い仕様である気がする。

他のlibxml系ライブラリはどのようにハンドリングしているかを調査してみようかな。とりあえずPerlのLibXMLを見てみよう。

【広告】