-
Notifications
You must be signed in to change notification settings - Fork 37
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
NonStrict flag for CPAN::Meta::YAML interop #44
Comments
CPAN::Meta::YAML is a thin wrapper around YAML::Tiny. However, I wonder if it should instead be a wrapper around YAML::XS (if XS is available), falling back to YAML::Tiny otherwise? (Maybe I should have opened a new ticket for that. sorry!) |
@karenetheridge: This will not work because both YAML::XS and YAML are broken and inconsistent. YAML and YAML::XS insists on failing hard on illegal structure or elements, the CPAN::Meta::YAML validator is useless with them, because the parser returns a fatal error and {}. p5p is right by insisting on their own YAML::Tiny based library, but I want some performance from a maintained YAML::XS library, which excludes YAML::Syck. So I'm gonna fix YAML and YAML::XS. |
Having a nonstrict/lax parser option sounds totally fine to me if it's not the default (or it will break backwards compatibility). |
@karenetheridge: It is already broken for many years. There's not much backcompat to keep. @ingydotnet : NonStrict is off by default, only turned on by the perl toolchain YAML loaders. It's fine for me if you prefer to throw strict errors, even if it breaks CPAN. But then the toolchain folks need to come to a decision what to do with illegal yaml, and how to define illegal yaml. They accept illegal yaml as "fixable", so I came up with this NonStrict mode. See Perl-Toolchain-Gang/CPAN-Meta#106 |
Enhance the documentation for JSON and YAML backends. Add tests for some cperl builtin prereqs. t/validator.t now tests all installed YAML and JSON backends. Skip one fixable testfile for which YAML and YAML::XS do not agree. See ingydotnet/yaml-libyaml-pm#44 and Perl-Toolchain-Gang#106
optionally allow certian reader errors. needed for perl YAML validation tests. See ingydotnet/yaml-libyaml-pm#44
optionally allow certian reader errors. needed for perl YAML validation tests. See ingydotnet/yaml-libyaml-pm#44
optionally allow certian reader errors. needed for perl YAML validation tests. See ingydotnet/yaml-libyaml-pm#44
LibYAML is too strict to be able to parse YAML/CPAN-Meta-YAML generated code, and pass the CPAN-Meta validation tests. Add a NonStrict mode, 2 tests still fail. Also add a native LoadFile method while we are here. See ingydotnet/yaml-libyaml-pm#44
optionally allow certian reader errors. needed for perl YAML validation tests. See ingydotnet/yaml-libyaml-pm#44
The dash is part of the indentation. That's how I understand the spec, and most others do. All yaml processors I know (the ones that are in yaml-editor) accept zero indented sequences, except YAML.pm. So this is a bug in YAML.pm. Feel free to fix it.
Can you please back that up with examples? What do you mean by "All other YAML loaders", and what do you mean by "illegal elements"? Also see http://matrix.yaml.io/ |
optionally allow certian reader errors. needed for perl YAML validation tests. See ingydotnet/yaml-libyaml-pm#44
optionally allow certian reader errors. needed for perl YAML validation tests. See ingydotnet/yaml-libyaml-pm#44
Released YAML.pm 1.25_001 which supports zero indented block sequences |
optionally allow certian reader errors. needed for perl YAML validation tests. See ingydotnet/yaml-libyaml-pm#44
optionally allow certian reader errors. needed for perl YAML validation tests. See ingydotnet/yaml-libyaml-pm#44
optionally allow certian reader errors. needed for perl YAML validation tests. See ingydotnet/yaml-libyaml-pm#44
optionally allow certian reader errors. needed for perl YAML validation tests. See ingydotnet/yaml-libyaml-pm#44
optionally allow certian reader errors. needed for perl YAML validation tests. See ingydotnet/yaml-libyaml-pm#44
My plan is to use the best and fastest YAML module for YAML load and dump in core (as Cpanel::JSON::XS for json).
But LibYAML is too strict for the CPAN::Meta validation tests.
The root cause is that CPAN::Meta::YAML is broken, accepting too much illegal YAML.
I cannot load too many .yml files from CPAN prefs and build dirs.
So I am writing a NonStrict mode to workaround those quirks.
I'm ok with rejecting illegal structures, which would lead to
t/data-fixable/98042513-META.yml
being not fixable but illegal.because the value for Class::Date is missing, and will not be assigned to undef (as CPAN::Meta::YAML, i.e. YAML::Tiny) does.
But this should be fixable with my new $NonStrict flag:
The illegal control characters are ignored then.
The 2nd problem is an illegal utf8 codepoint conflicts with perl core.
There I'm not sure yet if its a libyaml bug or a CPAN::Meta bug or really an illegal utf8 codepoint:
YAML::XS::LoadFile Error: The problem
was found at document: 25708, offset: 70
Ok with this plan?
BTW: As you can see in the errmsgs I have already written a XS version for LoadFile,
which uses the better file iterator. Unfortunately I haven't yet wired the filename from XS down to libyaml, which only needs a FILE*. So the errmsg is not good enough yet. But still better than now. You'll see with my upcoming PR.
The text was updated successfully, but these errors were encountered: