From: Bob Foxworthington Date: 2008-07-14T20:32:18+09:00 Subject: Re: Tidy segfault on Linux Hi Lee & Scott, we ran into the excat same issue Lee described in http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/282246 We tried the patch as suggested by Scott in http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/282454 Unfortunately, no luck... we still segfault. Just wondering if you were able to solve it... and if so, how? We have Ruby 1.8.5, Tidy Gem 1.1.2, libtidy 0.99 on CentOS 5.2 (x86_64). One thing we found is that Tidy seems to only segfault if one feeds it *valid* HTML. If one feeds it bad HTML, it doesn't crash (see example below). Thanks! Bob ---8<------------------------------------------------------------------------- require "rubygems" require "tidy" Tidy.path = "/usr/lib64/libtidy.so" Tidy.open do |t| puts "*** BAD SAMPLE" t.clean "I am bad HTML!" puts t.errors puts t.diagnostics end Tidy.open do |t| puts "*** GOOD SAMPLE" t.clean '' + 'foo

bar

' puts t.errors puts t.diagnostics end ---8<------------------------------------------------------------------------- Outputs the following: *** BAD SAMPLE line 1 column 1 - Warning: missing declaration line 1 column 7 - Warning: plain text isn't allowed in elements line 1 column 7 - Info: previously mentioned line 1 column 7 - Warning: inserting implicit line 1 column 7 - Warning: inserting missing 'title' element Info: Document content looks like HTML 3.2 4 warnings, 0 errors were found! *** GOOD SAMPLE (eval):5: [BUG] Segmentation fault ruby 1.8.5 (2006-08-25) [x86_64-linux] Aborted