Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing YAML without separator [rt.cpan.org #34073] #35

Open
toddr opened this issue May 11, 2017 · 3 comments
Open

Parsing YAML without separator [rt.cpan.org #34073] #35

toddr opened this issue May 11, 2017 · 3 comments

Comments

@toddr
Copy link
Member

toddr commented May 11, 2017

Migrated from rt.cpan.org#34073 (status was 'stalled')

Requestors:

From andk@cpan.org on 2008-03-14 07:24:30:

Today I encountered a META.yml file that contained nothing but:

% od -c META.yml                                                       
               
0000000   -   -  \n
0000003

YAML.pm throws an error on it but YAML::Syck translates it. Watch yourself:

% ysh -MYAML::Syck < META.yml
$VAR1 = '--';

% ysh -MYAML < META.yml
YAML Error: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 1
   Document: 2
 at /usr/share/perl5/YAML.pm line 33


Cheers,

From avar@cpan.org on 2010-05-20 11:29:31:

(This is a form-reply that isn't specific to your particular report)

YAML::Syck has just acquired one new maintainer (me), it still doesn't
have anyone that *cares* about it. But I'm willing to help solve your
report & release a new version with the fix if it's easy for me.

It now has a Git repository at:

    http://github.com/avar/YAML-Syck

If your report is a patch that fixes a problem, great. Please remake
the patch against Git by forking that repo and sending me a pull
request on GitHub (or an update to this bug if you prefer
git-format-patch(1) or some other repo provider..). Make sure to
include a test for what you fixed.

If your report is some code that fails (and you have a testcase for
it) a patch against the test suite to demonstrate that failure would
be very useful. It's OK if the test crashes and burns, see
Test::More's docs for how to make TODO tests that fail now, but
shouldn't. Even if it segfaults perl C<system $^X => qw/ -Mblib
-MYAML::Syck .../> or something like that and checking the return
value will do.

From toddr@cpan.org on 2010-07-19 20:59:51:

$>perl -MYAML -E 'Load "--\n"; print "Success!\n"'
YAML Error: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 1
   Document: 2
 at /usr/local/perl/510/lib/5.10.1/YAML.pm line 36


$>perl -MYAML::Syck -E 'Load "--\n"; print "Success!\n"'
Success!

From toddr@cpan.org on 2010-07-19 21:16:09:

Current behavior is to not die, but return what was passed in. I believe the correct behavior 
would be do die on a bad Load, but Syck's been out there a while. It might be a bad idea to fix it 
now.

TODO tests added: 84fbc0261b1e1012f065413e6351b7a1c4ccb3ec
@perlpunk
Copy link
Collaborator

This is actually valid YAML, so YAML::Syck is correct here.

@toddr
Copy link
Member Author

toddr commented Aug 20, 2017

@perlpunk so I need to adjust the todo tests then?

@perlpunk
Copy link
Collaborator

@toddr Actually, I realized that we're talking about YAML 1.0 here, not 1.1/1.2, and I don't know if that's valid. Sorry for the confusion ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants