Created
March 14, 2012 23:43
-
-
Save acrmp/2040448 to your computer and use it in GitHub Desktop.
Nokogiri custom xpath function segfault
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
xml = %q{ | |
<foo> | |
<foo/> | |
</foo> | |
} | |
doc = Nokogiri::XML.parse(xml) | |
puts doc.xpath('//foo[bool_function(bar/baz)]', Class.new { | |
def bool_function(value) | |
true | |
end | |
}.new) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<foo> | |
<foo/> | |
</foo> | |
<foo/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/node.rb:159: [BUG] Segmentation fault | |
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0] | |
-- Control frame information ----------------------------------------------- | |
c:0008 p:---- s:0031 b:0031 l:000030 d:000030 CFUNC :evaluate | |
c:0007 p:0101 s:0026 b:0026 l:000016 d:000025 BLOCK /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/node.rb:159 | |
c:0006 p:---- s:0022 b:0022 l:000021 d:000021 FINISH | |
c:0005 p:---- s:0020 b:0020 l:000019 d:000019 CFUNC :map | |
c:0004 p:0070 s:0017 b:0017 l:000016 d:000016 METHOD /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/node.rb:150 | |
c:0003 p:0075 s:0009 b:0008 l:002138 d:000078 EVAL custom-functions.rb:10 | |
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH | |
c:0001 p:0000 s:0002 b:0002 l:002138 d:002138 TOP | |
-- Ruby level backtrace information ---------------------------------------- | |
custom-functions.rb:10:in `<main>' | |
/Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/node.rb:150:in `xpath' | |
/Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/node.rb:150:in `map' | |
/Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/node.rb:159:in `block in xpath' | |
/Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/node.rb:159:in `evaluate' | |
-- C level backtrace information ------------------------------------------- | |
See Crash Report log file under ~/Library/Logs/CrashReporter or | |
/Library/Logs/CrashReporter, for the more detail of. | |
-- Other runtime information ----------------------------------------------- | |
* Loaded script: custom-functions.rb | |
* Loaded features: | |
0 enumerator.so | |
1 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/x86_64-darwin10.8.0/enc/encdb.bundle | |
2 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/x86_64-darwin10.8.0/enc/trans/transdb.bundle | |
3 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/defaults.rb | |
4 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/x86_64-darwin10.8.0/rbconfig.rb | |
5 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/deprecate.rb | |
6 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/exceptions.rb | |
7 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb | |
8 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb | |
9 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/version.rb | |
10 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/requirement.rb | |
11 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/platform.rb | |
12 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb | |
13 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/path_support.rb | |
14 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb | |
15 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/nokogiri.bundle | |
16 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/version.rb | |
17 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/syntax_error.rb | |
18 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/pp/node.rb | |
19 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/pp/character_data.rb | |
20 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/pp.rb | |
21 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/parse_options.rb | |
22 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/sax/document.rb | |
23 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/sax/parser_context.rb | |
24 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/sax/parser.rb | |
25 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/sax/push_parser.rb | |
26 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/sax.rb | |
27 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/x86_64-darwin10.8.0/stringio.bundle | |
28 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/node/save_options.rb | |
29 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/node.rb | |
30 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/attribute_decl.rb | |
31 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/element_decl.rb | |
32 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/element_content.rb | |
33 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/character_data.rb | |
34 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/namespace.rb | |
35 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/attr.rb | |
36 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/dtd.rb | |
37 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/cdata.rb | |
38 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/text.rb | |
39 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/document.rb | |
40 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/document_fragment.rb | |
41 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/processing_instruction.rb | |
42 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/node_set.rb | |
43 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/syntax_error.rb | |
44 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/xpath/syntax_error.rb | |
45 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/xpath.rb | |
46 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/xpath_context.rb | |
47 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/builder.rb | |
48 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/reader.rb | |
49 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/notation.rb | |
50 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/entity_decl.rb | |
51 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/schema.rb | |
52 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml/relax_ng.rb | |
53 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xml.rb | |
54 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xslt/stylesheet.rb | |
55 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/xslt.rb | |
56 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/html/entity_lookup.rb | |
57 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/html/document.rb | |
58 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/html/document_fragment.rb | |
59 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/html/sax/parser_context.rb | |
60 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/html/sax/parser.rb | |
61 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/html/sax/push_parser.rb | |
62 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/html/element_description.rb | |
63 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/html/element_description_defaults.rb | |
64 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/html.rb | |
65 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/decorators/slop.rb | |
66 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/css/node.rb | |
67 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/css/xpath_visitor.rb | |
68 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/x86_64-darwin10.8.0/racc/cparse.bundle | |
69 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/racc/parser.rb | |
70 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/thread.rb | |
71 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/css/parser_extras.rb | |
72 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/css/parser.rb | |
73 /Users/andrew/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/x86_64-darwin10.8.0/strscan.bundle | |
74 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/css/tokenizer.rb | |
75 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/css/syntax_error.rb | |
76 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/css.rb | |
77 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri/html/builder.rb | |
78 /Users/andrew/.rvm/gems/ruby-1.9.3-p0/gems/nokogiri-1.5.2/lib/nokogiri.rb | |
[NOTE] | |
You may have encountered a bug in the Ruby interpreter or extension libraries. | |
Bug reports are welcome. | |
For details: http://www.ruby-lang.org/bugreport.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fix released in Nokogiri 1.5.3.