Skip to content

various updates to 0.1.7#27

Open
rurban wants to merge 21 commits intoyaml:masterfrom
rurban:perl-yaml-xs
Open

various updates to 0.1.7#27
rurban wants to merge 21 commits intoyaml:masterfrom
rurban:perl-yaml-xs

Conversation

@rurban
Copy link
Copy Markdown
Contributor

@rurban rurban commented Dec 1, 2016

  • fix C++ g++-6/clang++-4 errors

  • Fixed most compiler warnings -Wall -Wextra
    repro:
    CFLAGS="-Wall -Wextra -Wunused-parameter -Wc++-compat" ./configure && make

  • add 2 new flags:

    • problem_nonstrict to yaml_parser_t
    • indentless_map to yaml_emitter_t

indentless_map is for backcompat with yaml readers.

It changes the default indent behavior of map elements,
advance the indent the children of the map
according to the spec: 6.1 Indentation Spaces:

      "Each node must be indented further than its parent node.  All sibling nodes
      must use the exact same indentation level.  However the content of each
      sibling node may be further indented independently."
      http://yaml.org/spec/1.2/spec.html#id2777534

This make it readable by YAML.pm (perl),
and behaves the same as all other YAML writers.

problem_nonstrict is to skip aborting on some reader errors:
"control characters are not allowed"
The error is set, but parsing is continued. This allows optionally
accepting invalid string values, copy-as-is, avoiding data-loss.

fweimer-rh and others added 20 commits December 1, 2016 22:52
https://bitbucket.org/xi/libyaml/issue/10/wrapped-strings-cause-assert-failure

Commenting out the assert makes the scanner do the right thing and
results in just a simple parse failure.
This directory contains instructions and code for getting a libyaml
development environment running.
repro:
  CFLAGS="-Wall -Wextra -Wunused-parameter -Wc++-compat" ./configure && make

which we use for perl, and libyaml is now included in cperl.
Tested with gcc-5 and clang-3.7

There are still a tons of format warnings (%d on 64bit) in
example-deconstructor.c which I skipped.
add 2 new flags:
* problem_nonstrict to yaml_parser_t
* indentless_map to yaml_emitter_t

indentless_map is for backcompat with yaml readers.

It changes the default indent behavior of map elements,
advance the indent the children of the map
according to the spec: 6.1 Indentation Spaces:

      "Each node must be indented further than its parent node.  All sibling nodes
      must use the exact same indentation level.  However the content of each
      sibling node may be further indented independently."
      http://yaml.org/spec/1.2/spec.html#id2777534

This make it readable by YAML.pm (perl),
and behaves the same as all other YAML writers.

problem_nonstrict is to skip aborting on some reader errors:
"control characters are not allowed"
The error is set, but parsing is continued. This allows optionally
accepting invalid string values, copy-as-is, avoiding data-loss.
to be able to set breakpoints.
also fix some pedantic warnings, remove unused code.
optionally allow certian reader errors.
needed for perl YAML validation tests.
See ingydotnet/yaml-libyaml-pm#44
Perl CPAN silently allows any unknown escape chars to pass them to
regexp. Mimic that in nonstrict mode.
we cannot malloc to an anon struct in C++.
typedef yaml_anchors_t
remove unneeded context, which is not set in any macro.
for void context, to fix -Wunused-value warnings
yaml_emitter_write_indicator const char *indicator
@sigmavirus24
Copy link
Copy Markdown
Contributor

Hi @rurban! Thanks for collating all of this. It'd be easier to review, however, and would make our lives better if you could split this up into separate pull requests.

Fixing compiler errors and warnings is fine, but tossing in new code atop that makes things very difficult to review. Please split these out.

@rurban
Copy link
Copy Markdown
Contributor Author

rurban commented Dec 26, 2016

@sigmavirus24 no. I submitted these accumulated changes over the last year in various forms to the various proper upstream places. now this seems to be a new upstream.
do it by yourself, or I'll have to fork it, when you are not able to maintain it and be able to discuss any problems. yaml is seriously broken and see no willingness to fix it upstream.

ingy promised to merge it for over a year now.

@perlpunk
Copy link
Copy Markdown
Member

Just a note: @tlsa helped finding out that the yaml_free(version_directive) in commit "fix version_directive memory leak" is actually wrong.
@tlsa's suggestion was:

if (version_directive_ref == NULL) {
        yaml_free(version_directive);
}

I confirmed that with:

% echo "%YAML 1.1\n--- foo" | ./tests/run-parser-test-suite
+STR
+DOC ---
=VAL :foo
-DOC
-STR

vs.

% echo "%YAML 1.1\n--- foo" | ./tests/run-parser-test-suite
+STR
+DOC ---
=VAL :\0\0\0
-DOC
-STR

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

Successfully merging this pull request may close these issues.

6 participants