[libxml-devel] 0.9.8 crashes on Mac OS X

Jacob Lauemøller jacob.lauemoeller at iteray.com
Fri Feb 20 09:03:28 EST 2009


Hi guys

I'm having major problems with libxml-ruby version 0.9.8 on Mac OS X  
10.5.6. The gem installs without problems, but schema validation  
errors result in a Bus Error or Segmentation Fault.

The problem doesn't occur when the same code is run against 0.9.7, nor  
does it occur with 0.9.8. on Ubuntu.

I have constructed the following sample program which illustrates the  
problem:

-----------------------[ validate.rb ]----------------
require 'rubygems'
require 'libxml'

include LibXML

if ARGV.length < 2
puts 'Wrong number of arguments'
puts 'ruby validate.rb path/to/schema/file path/to/xml/file...'
exit 1
end

schema = XML::Schema.document(XML::Document.file(ARGV.shift))

ARGV.each do | xml_file_name |
instance = XML::Document.file(xml_file_name)
result = instance.validate_schema(schema) do |message, is_error|
   puts "#{is_error ? 'ERROR' : 'WARNING'}: #{xml_file_name}:  
#{message}"
end

puts "#{xml_file_name} is #{result ? 'VALID' : 'INVALID'}"
end
--------------------------------------------------

-----------------------[ schema.rb ]----------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
targetNamespace="http://not.important/status"
xmlns:tns="http://not.important/status"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xs:complexType name="Release">
   <xs:sequence>
     <xs:element name="name" type="xs:string"/>
     <xs:element name="state" type="xs:string"/>
   </xs:sequence>
</xs:complexType>

<xs:element name="release" type="tns:Release"/>
</xs:schema>
---------------------------------------------------

-----------------------[ sample1.xml ]---------------
<?xml version="1.0" encoding="UTF-8"?>
<release xmlns="http://not.important/status">
<Name>release</Name>
<state>Ready</state>
</release>
---------------------------------------------------

Running validate.rb with the schema and sample xml file should  
generate a validation error since  the 'name' element is misspelled.  
But instead (on Mac OS X) I get

$ ruby validate.rb schema.xsd sample1.xml
validate.rb:16: [BUG] Segmentation fault
ruby 1.8.6 (2008-03-03) [universal-darwin9.0]

Abort trap

With 0.9.7 I get

Error: Element 'release' [CT 'Release']: The element content is not  
valid. at sample1.xml:0.
validate.rb:16:in `validate_schema': Error: Element 'release' [CT  
'Release']: The element content is not valid. at sample1.xml:0.  
(LibXML::XML::Error)
	from validate.rb:16
	from validate.rb:14:in `each'
	from validate.rb:14

On Ubuntu, 0.9.8 gives me

Error: Element '{http://not.important/status}Name': This element is  
not expected. Expected is ( {http://not.important/status}name ). at  
sample1.xml:3.
validate.rb:16:in `validate_schema': Error: Element '{http://not.important/status 
}Name': This element is not expected. Expected is ( {http://not.important/status 
}name ). at sample1.xml:3. (LibXML::XML::Error)
	from validate.rb:16
	from validate.rb:14:in `each'
	from validate.rb:14

which is spot on.

ruby --version on the Mac yields

	ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]

and on Ubuntu

	ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]

The Mac OS X Problem Report for the 0.9.8 case looks like this:

Process:         ruby [26788]
Path:            /usr/bin/ruby
Identifier:      ruby
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  bash [24391]

Date/Time:       2009-02-20 13:27:09.694 +0100
OS Version:      Mac OS X 10.5.6 (9G55)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000014000004
Crashed Thread:  0

Thread 0 Crashed:
0   libSystem.B.dylib             	0x93d15e42 __kill + 10
1   libSystem.B.dylib             	0x93d8823a raise + 26
2   libSystem.B.dylib             	0x93d94679 abort + 73
3   libruby.1.dylib               	0x000cdc10 rb_exc_new + 0
4   libruby.1.dylib               	0x0013460f rb_gc_mark_trap_list + 508
5   libSystem.B.dylib             	0x93d142bb _sigtramp + 43
6   ???                           	0xffffffff 0 + 4294967295
7   libruby.1.dylib               	0x000cfdfc rb_clear_cache_by_class  
+ 141
8   libruby.1.dylib               	0x000db655 rb_obj_respond_to + 129
9   libruby.1.dylib               	0x000db6e1 rb_respond_to + 32
10  libxml_ruby.bundle            	0x0019f4ce structuredErrorFunc + 110
11  libxml2.2.dylib               	0x915402ba __xmlRaiseError + 1029
12  libxml2.2.dylib               	0x915a4eef xmlSchemaSetValidOptions  
+ 5875
13  libxml2.2.dylib               	0x915aa076  
xmlSchemaNewDocParserCtxt + 8158
14  libxml2.2.dylib               	0x915a90fa  
xmlSchemaNewDocParserCtxt + 4194
15  libxml2.2.dylib               	0x915b8733  
xmlSchemaNewDocParserCtxt + 67227
16  libxml2.2.dylib               	0x915b8841 xmlSchemaValidateDoc + 129
17  libxml_ruby.bundle            	0x0019e462  
rxml_document_validate_schema + 129
18  libruby.1.dylib               	0x000da14c rb_eval_string_wrap +  
16637
19  libruby.1.dylib               	0x000dad2a rb_eval_string_wrap +  
19675
20  libruby.1.dylib               	0x000d809a rb_eval_string_wrap + 8267
21  libruby.1.dylib               	0x000d70d7 rb_eval_string_wrap + 4232
22  libruby.1.dylib               	0x000d89ec rb_eval_string_wrap +  
10653
23  libruby.1.dylib               	0x000de138 rb_thread_trap_eval + 2393
24  libruby.1.dylib               	0x000defe6 rb_yield + 33
25  libruby.1.dylib               	0x000bfc7d rb_ary_each + 30
26  libruby.1.dylib               	0x000da14c rb_eval_string_wrap +  
16637
27  libruby.1.dylib               	0x000dad2a rb_eval_string_wrap +  
19675
28  libruby.1.dylib               	0x000d809a rb_eval_string_wrap + 8267
29  libruby.1.dylib               	0x000d70d7 rb_eval_string_wrap + 4232
30  libruby.1.dylib               	0x000e702e rb_load_protect + 298
31  libruby.1.dylib               	0x000e705f ruby_exec + 22
32  libruby.1.dylib               	0x000e708b ruby_run + 42
33  ruby                          	0x00001fff 0x1000 + 4095
34  ruby                          	0x00001fa6 start + 54

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x00000000  ebx: 0x93d94639  ecx: 0xbfffd65c  edx: 0x93d15e42
  edi: 0xa04a2690  esi: 0x00000010  ebp: 0xbfffd678  esp: 0xbfffd65c
   ss: 0x0000001f  efl: 0x00000286  eip: 0x93d15e42   cs: 0x00000007
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
  cr2: 0xffe2aa74

Binary Images:
    0x1000 -     0x1ffe +ruby ??? (???)  
<660a81a680415ef4ca4d85d3104eed85> /usr/bin/ruby
   0x3a000 -    0x3bffc  thread.bundle ??? (???)  
<d62a9b0eba909a01e0f24cda4d3f8b46> /System/Library/Frameworks/ 
Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0/ 
thread.bundle
   0x98000 -    0x9affd  stringio.bundle ??? (???)  
<6ef963050f33481408e309d4ac8a06c7> /System/Library/Frameworks/ 
Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0/ 
stringio.bundle
   0xbf000 -   0x15cffb  libruby.1.dylib ??? (???)  
<bf28599e1ca8de35546083fa05758cf8> /System/Library/Frameworks/ 
Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib
  0x17e000 -   0x191ff7  syck.bundle ??? (???)  
<12c497c718eb3c5b47d3f286b531dfc4> /System/Library/Frameworks/ 
Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0/ 
syck.bundle
  0x197000 -   0x197ffc  etc.bundle ??? (???)  
<b9f04200980be0fe3973b21401e5e37f> /System/Library/Frameworks/ 
Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0/ 
etc.bundle
  0x19b000 -   0x1b4ffc +libxml_ruby.bundle ??? (???)  
<7dadcfbc46249cc29bd4d9451269cba6> /Library/Ruby/Gems/1.8/gems/libxml- 
ruby-0.9.8/lib/libxml_ruby.bundle
0x8fe00000 - 0x8fe2db43  dyld 97.1 (???)  
<100d362e03410f181a34e04e94189ae5> /usr/lib/dyld
0x90853000 - 0x9085afe9  libgcc_s.1.dylib ??? (???)  
<f53c808e87d1184c0f9df63aef53ce0b> /usr/lib/libgcc_s.1.dylib
0x90ab6000 - 0x90beeff7  libicucore.A.dylib ??? (???)  
<18098dcf431603fe47ee027a60006c85> /usr/lib/libicucore.A.dylib
0x9151a000 - 0x915fbff7  libxml2.2.dylib ??? (???)  
<d69560099d9eb32ba7f8a17baa65a28d> /usr/lib/libxml2.2.dylib
0x93ca7000 - 0x93e0eff3  libSystem.B.dylib ??? (???)  
<d68880dfb1f8becdbdac6928db1510fb> /usr/lib/libSystem.B.dylib
0x95416000 - 0x95424ffd  libz.1.dylib ??? (???)  
<5ddd8539ae2ebfd8e7cc1c57525385c7> /usr/lib/libz.1.dylib
0x95a2f000 - 0x95a8cffb  libstdc++.6.dylib ??? (???)  
<04b812dcec670daa8b7d2852ab14be60> /usr/lib/libstdc++.6.dylib
0x95d38000 - 0x95d3cfff  libmathCommon.A.dylib ??? (???) /usr/lib/ 
system/libmathCommon.A.dylib
0x95f97000 - 0x9608bff4  libiconv.2.dylib ??? (???)  
<c508c60fafca17824c0017b2e4369802> /usr/lib/libiconv.2.dylib
0xffff0000 - 0xffff1780  libSystem.B.dylib ??? (???) /usr/lib/ 
libSystem.B.dylib

Any ideas?
Kind regards,

Jacob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1933 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/libxml-devel/attachments/20090220/0b49110f/attachment.bin>


More information about the libxml-devel mailing list