From: Martin Pirker Date: 2004-08-10T02:46:17+09:00 Subject: yaml bug(?) in pre2 given: large dataset dump via .to_yaml read back from file with YAML::load(f) runs ok write+read with V1: ruby 1.8.1 (2004-05-02) [i686-linux-gnu] V2: ruby 1.8.2 (2004-07-16) [i686-linux] (aka pre1) broken with V3: ruby 1.8.2 (2004-07-29) [i686-linux] (aka pre2) V3 reads dump produced by V1+V2 ok V1+V2 crash on reading dump from V3 cut down testcase, structure dumped with V3: ------------------------ cut here ------------------------ --- "sfdfdsdsffsdsfdfd": - - whatever: - something - >+ cdvfd: fddfdddd - | test -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ - 999999999 ------------------------ cut here ------------------------ crash on reading: irb(main):038:0> File::open("yamltest","r") do |f| YAML::load(f) end ArgumentError: parse error on line 14, col 51: Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/' from /usr/lib/ruby/1.8/yaml.rb:119:in 'load' from /usr/lib/ruby/1.8/yaml.rb:119:in 'load' from (irb):38 from (irb):38:in en' from (irb):38 from :0 the problem appears to be the indentation of "test", if one moves it some spaces to front it works: irb(main):037:0> File::open("yamltest","r") do |f| YAML::load(f) end => {"sfdfdsdsffsdsfdfd"=>[[{"whatever"=>["something"]}, "cdvfd: fddfdddd\n\n", "\ntest\n\n--\nUsing M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/\n"], 999999999]} yaml dumper from V1+V2 dumps text segment in one line with \..\.. inserts and proper spaces for indentation testing with V4: ruby 1.8.2 (2004-08-08) [i686-linux] taken from CVS dump runs reading back in only gives size 2: irb(main):010:0> s = File::open("mydump","r") do |f| YAML::load(f) end irb(main):011:0> puts s.size 2 trying to read dump from V1+V2 gives: ArgumentError: parse error on line 172, col 300:..... which is a one line string with lotsa \...\... and he seems to choke on an umlaut u (sorry can't type that on my terminal now) so, can anybody read the file from V4? V3 can't, V4 seems do dump the same multiline text like V3, so of course V3 chokes reverting back to V2: irb(main):004:0> s = File::open("mydumpv2","r") do |f| YAML::load(f) end irb(main):005:0> puts s.size 1077 yep, that's how it should be Ruby versions from Gentoo, if that matters so after ~4 hours hunting: V3 emitter seems to be broken and introduces bug with texts which are dumped as multiline and don't start at first column V4 only reads in 2 obj instead of 1000+ and chokes on the upper testcase too I give up staying with V2 which is the last worksforme[tm] and will replace the dump/restore routine with a homegrown, after all it isn't a good idea to yaml so large datasets - gives pretty 100Mb memory fragmentation... Martin