yaml bug(?) in pre2

Discussion in 'Ruby' started by Martin Pirker, Aug 9, 2004.

  1. 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::eek:pen("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::eek:pen("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::eek:pen("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::eek:pen("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
    Martin Pirker, Aug 9, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dmitry Borisov

    ANN: PyMedia-1.2.3.0-pre2 is out

    Dmitry Borisov, Nov 4, 2004, in forum: Python
    Replies:
    0
    Views:
    344
    Dmitry Borisov
    Nov 4, 2004
  2. T. Onoma
    Replies:
    1
    Views:
    94
  3. RubyQuestions
    Replies:
    0
    Views:
    220
    RubyQuestions
    Dec 3, 2003
  4. Paul Battley

    YAML.dump/YAML.load bug

    Paul Battley, Aug 3, 2005, in forum: Ruby
    Replies:
    0
    Views:
    176
    Paul Battley
    Aug 3, 2005
  5. Shane Emmons

    [ANN] Money 3.1.0.pre2

    Shane Emmons, Aug 10, 2010, in forum: Ruby
    Replies:
    0
    Views:
    107
    Shane Emmons
    Aug 10, 2010
Loading...

Share This Page