Nil tag with implicit: false raises error on SnakeYAML
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 597
- Forks
- 223
- Avg merge
- 11h 23m
- Merged PRs (30d)
- 3
Description
The following line, when reached by the tests from #475, triggers SnakeYAML to raise an error:
The error:
RuntimeError: org.yaml.snakeyaml.emitter.EmitterException: tag is not specified
scalar at org/jruby/ext/psych/PsychEmitter.java:206
visit_Psych_Nodes_Scalar at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/emitter.rb:32
visit at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:30
accept at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:6
visit_Psych_Nodes_Mapping at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/emitter.rb:43
each at org/jruby/RubyArray.java:1864
visit_Psych_Nodes_Mapping at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/emitter.rb:43
visit at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:30
accept at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:6
visit_Psych_Nodes_Document at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/emitter.rb:27
each at org/jruby/RubyArray.java:1864
visit_Psych_Nodes_Document at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/emitter.rb:27
visit at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:30
accept at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:6
visit_Psych_Nodes_Stream at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/emitter.rb:21
each at org/jruby/RubyArray.java:1864
visit_Psych_Nodes_Stream at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/emitter.rb:21
visit at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:30
accept at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/visitors/visitor.rb:6
yaml at /Users/headius/projects/jruby/lib/ruby/stdlib/psych/nodes/node.rb:61
dump at /Users/headius/projects/jruby/lib/ruby/stdlib/psych.rb:515
<main> at blah.rb:13
As far as I can tell, the issue is that the tag is nil and implicit is false, which is prohibited in SnakeYAML for a mapping.
This is somewhat outside my understanding of YAML and I am not sure whether this constitutes an improper behavioral difference in SnakeYAML or not.
The implicit value comes from the default @implicit of Coder, and is never set to true in the logic hit by the tests mentioned above. As it stands I do not know how to reconcile the values being passed in with the SnakeYAML hard error.
This leads to the remaining failures in https://github.com/jruby/jruby/pull/6680, which I will exclude to proceed with the Psych update.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at lib/psych/visitors/yaml_tree.rb around line 520 and trace the nil tag and implicit value into the emitter, including org/jruby/ext/psych/PsychEmitter.java. Reproduce the tests from #475 or the remaining failures in JRuby PR #6680, then verify that dumping the affected mapping no longer triggers SnakeYAML's tag error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, ruby
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100