Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the YAML CPAN distribution.

Report information
The Basics
Id: 52837
Status: open
Priority: 0/
Queue: YAML

People
Owner: Nobody in particular
Requestors: sharyanto [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.70



Subject: Can't handle this sample data
Download (untitled) / with headers
text/plain 870b
$ cat us_address - address - +keys: zipcode: [str, {len: 5, match: '^\d{5}$', required: Yes}] country: [str, {is: US}] -keys: postcode: ~ -allowed_keys: [postcode] -required_keys: [postcode] +required_keys: [zipcode] +allowed_keys: [zipcode] $ perl -MYAML -0777 -ne'print Dump Load $_' us_address YAML Error: Inconsistent indentation level Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION Line: 3 Document: 1 at /usr/local/share/perl/5.10.0/YAML.pm line 36 but all the other modules I tried handles it fine (although YAML::Tiny parses it totally wrongly): $ perl -MYAML::XS -0777 -ne'print Dump Load $_' us_address --- ... $ perl -MYAML::Tiny -0777 -ne'print Dump Load $_' us_address --- ... $ perl -MYAML::XS -0777 -ne'print Dump Load $_' us_address --- ... $ ruby -ryaml -0777 -ne'puts YAML::load($_).to_yaml' us_address --- ...
Download (untitled) / with headers
text/plain 327b
On Wed Dec 16 12:19:50 2009, SHARYANTO wrote: Show quoted text
> $ perl -MYAML::XS -0777 -ne'print Dump Load $_' us_address > --- > ... > > $ perl -MYAML::Tiny -0777 -ne'print Dump Load $_' us_address > --- > ... > > $ perl -MYAML::XS -0777 -ne'print Dump Load $_' us_address > --- > ...
Sorry, one of the YAML::XS should've been YAML::Syck.
Subject: Re: [rt.cpan.org #52837] Can't handle this sample data
Date: Thu, 17 Dec 2009 15:57:20 +1100
To: bug-YAML [...] rt.cpan.org
From: Adam Kennedy <adamkennedybackup [...] gmail.com>
Download (untitled) / with headers
text/plain 1.4k
Is this meant to be legal YAML? It looks weirdly like a diff to me... Adam K 2009/12/17 steven haryanto via RT <bug-YAML@rt.cpan.org>: Show quoted text
> Wed Dec 16 12:19:50 2009: Request 52837 was acted upon. > Transaction: Ticket created by SHARYANTO >       Queue: YAML >     Subject: Can't handle this sample data >   Broken in: (no value) >    Severity: (no value) >       Owner: Nobody >  Requestors: sharyanto@cpan.org >      Status: new >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=52837 > > > > $ cat us_address > - address > - +keys: >    zipcode: [str, {len: 5, match: '^\d{5}$', required: Yes}] >    country: [str, {is: US}] >  -keys: >    postcode: ~ >  -allowed_keys:  [postcode] >  -required_keys: [postcode] >  +required_keys: [zipcode] >  +allowed_keys:  [zipcode] > > $ perl -MYAML -0777 -ne'print Dump Load $_' us_address > YAML Error: Inconsistent indentation level >   Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION >   Line: 3 >   Document: 1 >  at /usr/local/share/perl/5.10.0/YAML.pm line 36 > > but all the other modules I tried handles it fine (although YAML::Tiny > parses it totally wrongly): > > $ perl -MYAML::XS -0777 -ne'print Dump Load $_' us_address > --- > ... > > $ perl -MYAML::Tiny -0777 -ne'print Dump Load $_' us_address > --- > ... > > $ perl -MYAML::XS -0777 -ne'print Dump Load $_' us_address > --- > ... > > $ ruby -ryaml -0777 -ne'puts YAML::load($_).to_yaml' us_address > --- > ... > > >
Download (untitled) / with headers
text/plain 3.4k
Yup. It's just hashes with some + and - prefixes on the keys. (For use with Data::ModeMerge). $ perl -MData::Dumper -MYAML::XS -0777 -ne'$Data::Dumper::Indent=1; print Dumper Load $_' us_address $VAR1 = [ 'address', { '+allowed_keys' => [ 'zipcode' ], '+keys' => { 'country' => [ 'str', { 'is' => 'US' } ], 'zipcode' => [ 'str', { 'len' => 5, 'required' => 'Yes', 'match' => '^\\d{5}$' } ] }, '+required_keys' => [ 'zipcode' ], '-keys' => { 'postcode' => undef }, '-required_keys' => [ 'postcode' ], '-allowed_keys' => [ 'postcode' ] } ]; On Wed Dec 16 23:57:37 2009, adam@ali.as wrote: Show quoted text
> Is this meant to be legal YAML? > > It looks weirdly like a diff to me... > > Adam K > > 2009/12/17 steven haryanto via RT <bug-YAML@rt.cpan.org>:
> > Wed Dec 16 12:19:50 2009: Request 52837 was acted upon. > > Transaction: Ticket created by SHARYANTO > >       Queue: YAML > >     Subject: Can't handle this sample data > >   Broken in: (no value) > >    Severity: (no value) > >       Owner: Nobody > >  Requestors: sharyanto@cpan.org > >      Status: new > >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=52837 > > > > > > > $ cat us_address > > - address > > - +keys: > >    zipcode: [str, {len: 5, match: '^\d{5}$', required: Yes}] > >    country: [str, {is: US}] > >  -keys: > >    postcode: ~ > >  -allowed_keys:  [postcode] > >  -required_keys: [postcode] > >  +required_keys: [zipcode] > >  +allowed_keys:  [zipcode] > > > > $ perl -MYAML -0777 -ne'print Dump Load $_' us_address > > YAML Error: Inconsistent indentation level > >   Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION > >   Line: 3 > >   Document: 1 > >  at /usr/local/share/perl/5.10.0/YAML.pm line 36 > > > > but all the other modules I tried handles it fine (although
YAML::Tiny Show quoted text
> > parses it totally wrongly): > > > > $ perl -MYAML::XS -0777 -ne'print Dump Load $_' us_address > > --- > > ... > > > > $ perl -MYAML::Tiny -0777 -ne'print Dump Load $_' us_address > > --- > > ... > > > > $ perl -MYAML::XS -0777 -ne'print Dump Load $_' us_address > > --- > > ... > > > > $ ruby -ryaml -0777 -ne'puts YAML::load($_).to_yaml' us_address > > --- > > ... > > > > > >
Subject: Re: [rt.cpan.org #52837] Can't handle this sample data
Date: Thu, 17 Dec 2009 18:19:47 +1100
To: bug-YAML [...] rt.cpan.org
From: Adam Kennedy <adamkennedybackup [...] gmail.com>
Download (untitled) / with headers
text/plain 2.8k
I'm fairly certain that YAML::Tiny would officially not support complex content like that, although I might be able to do the + ones. Adam K 2009/12/17 steven haryanto via RT <bug-YAML@rt.cpan.org>: Show quoted text
>       Queue: YAML >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=52837 > > > Yup. It's just hashes with some + and - prefixes on the keys. (For use > with Data::ModeMerge). > > $ perl -MData::Dumper -MYAML::XS -0777 -ne'$Data::Dumper::Indent=1; > print Dumper Load $_' > us_address > $VAR1 = > [ >  'address', >  { >    '+allowed_keys' => > [ >      'zipcode' >    ], >    '+keys' => > { >      'country' => > [ >        'str', >        { >          'is' => > 'US' >        } >      ], >      'zipcode' => [ >        'str', >        { >          'len' => 5, >          'required' => 'Yes', >          'match' => '^\\d{5}$' >        } >      ] >    }, >    '+required_keys' => [ >      'zipcode' >    ], >    '-keys' => { >      'postcode' => undef >    }, >    '-required_keys' => [ >      'postcode' >    ], >    '-allowed_keys' => [ >      'postcode' >    ] >  } > ]; > > > > > On Wed Dec 16 23:57:37 2009, adam@ali.as wrote:
>> Is this meant to be legal YAML? >> >> It looks weirdly like a diff to me... >> >> Adam K >> >> 2009/12/17 steven haryanto via RT <bug-YAML@rt.cpan.org>:
>> > Wed Dec 16 12:19:50 2009: Request 52837 was acted upon. >> > Transaction: Ticket created by SHARYANTO >> >       Queue: YAML >> >     Subject: Can't handle this sample data >> >   Broken in: (no value) >> >    Severity: (no value) >> >       Owner: Nobody >> >  Requestors: sharyanto@cpan.org >> >      Status: new >> >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=52837 > >> > >> > >> > $ cat us_address >> > - address >> > - +keys: >> >    zipcode: [str, {len: 5, match: '^\d{5}$', required: Yes}] >> >    country: [str, {is: US}] >> >  -keys: >> >    postcode: ~ >> >  -allowed_keys:  [postcode] >> >  -required_keys: [postcode] >> >  +required_keys: [zipcode] >> >  +allowed_keys:  [zipcode] >> > >> > $ perl -MYAML -0777 -ne'print Dump Load $_' us_address >> > YAML Error: Inconsistent indentation level >> >   Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION >> >   Line: 3 >> >   Document: 1 >> >  at /usr/local/share/perl/5.10.0/YAML.pm line 36 >> > >> > but all the other modules I tried handles it fine (although
> YAML::Tiny
>> > parses it totally wrongly): >> > >> > $ perl -MYAML::XS -0777 -ne'print Dump Load $_' us_address >> > --- >> > ... >> > >> > $ perl -MYAML::Tiny -0777 -ne'print Dump Load $_' us_address >> > --- >> > ... >> > >> > $ perl -MYAML::XS -0777 -ne'print Dump Load $_' us_address >> > --- >> > ... >> > >> > $ ruby -ryaml -0777 -ne'puts YAML::load($_).to_yaml' us_address >> > --- >> > ... >> > >> > >> >
> > > >
Download (untitled) / with headers
text/plain 386b
On Thu Dec 17 02:20:05 2009, adam@ali.as wrote: Show quoted text
> I'm fairly certain that YAML::Tiny would officially not support > complex content like that, although I might be able to do the + ones.
Yup, I'm not expecting YAML::Tiny to do that either, and have never used YAML::Tiny anyway. Any reason why you do not plan to do the - ones as well? Possible ambiquity with sequence marker (dash)?
Subject: Re: [rt.cpan.org #52837] Can't handle this sample data
Date: Thu, 17 Dec 2009 20:09:12 +1100
To: bug-YAML [...] rt.cpan.org
From: Adam Kennedy <adamkennedybackup [...] gmail.com>
Download (untitled) / with headers
text/plain 718b
Yep, the ambiguity problem. Although if it can be solved effectively by adding a few characters to one of the parsing regex, I'll happily add support for it. Adam K 2009/12/17 steven haryanto via RT <bug-YAML@rt.cpan.org>: Show quoted text
>       Queue: YAML >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=52837 > > > On Thu Dec 17 02:20:05 2009, adam@ali.as wrote:
>> I'm fairly certain that YAML::Tiny would officially not support >> complex content like that, although I might be able to do the + ones.
> > Yup, I'm not expecting YAML::Tiny to do that either, and have never > used YAML::Tiny anyway. Any reason why you do not plan to do the - ones > as well? Possible ambiquity with sequence marker (dash)? > >
Download (untitled) / with headers
text/plain 370b
On Thu Dec 17 04:09:35 2009, adam@ali.as wrote: Show quoted text
> Yep, the ambiguity problem. > > Although if it can be solved effectively by adding a few characters to > one of the parsing regex, I'll happily add support for it.
Spec-wise there should be no ambiguity, as a whitespace is required for sequence marker. As for the implementation, I'll leave it to people in the know.
I think this problem is related. It doesn't handle the YAML it puts out.

I think the problem is line 384 in YAML::Loader::_parse_seq

        if ($self->preface =~ /^(\s*)(\w.*\:(?: |$).*)$/) {

I don't think there is any justification for needing a word character at the end of the whitespace following a dash node indicator. I found the easiest statement of this problem to be:

use feature 'say';
use Data::Dumper qw<Dumper>;
use YAML         qw<Load Dump>;
my $data = { One => { Two => [ { '.three' => [ 'Four' ] } ] } };
my $yaml = Dump( $data );
say Dumper( $yaml );
$data = Load( $yaml );
Show quoted text
### $data
say Dumper( $data );

Download (untitled) / with headers
text/plain 247b
This issue has been copied to: https://github.com/ingydotnet/yaml-pm/issues/101 please take all future correspondence there. This ticket will remain open but please do not reply here. This ticket will be closed when the github issue is dealt with.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.