require 'rexml/document' require 'tempfile' include REXML #- rexml sanity check again (bug in ruby 1.8.6-p111) xmldoc = Document.new "" xmldoc << XMLDecl.new(XMLDecl::DEFAULT_VERSION, 'UTF-8') elem = xmldoc.root.add_element('elem') elem.add_text('cdata') tmp = Tempfile.new("sanitytemp") tmp.close! ios = File.open(sanity_filename = tmp.path, File::RDWR|File::CREAT|File::EXCL) xmldoc.write(ios, 0) ios.close xmldoc = Document.new(File.new(sanity_filename)) File.delete(sanity_filename) if xmldoc.root.elements['elem'].get_text.value != 'cdata' puts "REXML sanity check failed (this is normal with unpatched ruby-1.8.6-p111, which ships a broken REXML). For safeness, won't proceed." puts "Notice for bug reporting: REXML has version: #{REXML::VERSION} at date: #{REXML::DATE}." exit 1 end