YAML bug

YAML seems to have a problem with stings over 8k in length.

require 'yaml'
x = "Z" * 8193
y x

/usr/local/lib/ruby/1.8/yaml/rubytypes.rb:315: [BUG] Segmentation fault
ruby 1.8.1 (2003-12-25) [i686-linux]

Aborted

Hmm... any ideas?

Stephen.

ruby 1.8.1 (2003-12-25) [i686-linux]

use a more recent version of ruby

Guy Decoux

ts <decoux@moulon.inra.fr> wrote in message news:<200406101205.i5AC5UK11235@moulon.inra.fr>...

> ruby 1.8.1 (2003-12-25) [i686-linux]

use a more recent version of ruby

Guy Decoux

Thank you, updating to 1.8.2 fixes the 8k bug, but now I have another problem:

require 'yaml'
class B
  def initialize
    @a = String # any class name
  end
end
x = B.new
y x
ArgumentError: can't dump anonymous class Class
        from c:/ruby/lib/ruby/1.8/yaml/rubytypes.rb:9:in `to_yaml'
        from c:/ruby/lib/ruby/1.8/yaml/baseemitter.rb:175:in `map'
        from c:/ruby/lib/ruby/1.8/yaml/baseemitter.rb:164:in `each'
        from c:/ruby/lib/ruby/1.8/yaml/baseemitter.rb:164:in `map'
        from c:/ruby/lib/ruby/1.8/yaml/rubytypes.rb:25:in `to_yaml'
        from c:/ruby/lib/ruby/1.8/yaml/rubytypes.rb:24:in `call'
        from c:/ruby/lib/ruby/1.8/yaml.rb:188:in `quick_emit'
        from c:/ruby/lib/ruby/1.8/yaml/rubytypes.rb:24:in `to_yaml'
        from c:/ruby/lib/ruby/1.8/yaml.rb:218:in `y'
        from (irb):40

It would be nice if yaml could dump classname constants - Marshal does this fine.

Stephen