Skip to content

Gem::YAMLSerializer::Parser only reads the first document of a YAML stream - #10088

Merged
hsbt merged 2 commits into
ruby:masterfrom
bensheldon:strip_extra_documents
Nov 17, 2026
Merged

hsbt merged 2 commits into
ruby:masterfrom
bensheldon:strip_extra_documents

Conversation

@bensheldon

Copy link
Copy Markdown
Contributor

What was the end-user or developer problem that led to this PR?

Closes #10087

This PR makes Gem::YAMLSerializer::Parser read only the first document of a multi-document YAML stream, which matches Psych.

What is your fix for the problem, implemented in this PR?

A new strip_extra_documents step runs before parsing and drops everything from the next --- document start marker onward. This is the same pattern the parser does for ... document end markers.

Make sure the following tasks are checked

@hsbt

hsbt commented Nov 17, 2026

Copy link
Copy Markdown
Member

Thanks for the fix! I pushed a few extra test cases from my local work on this, covering more --- forms and the Gem::Specification case from the issue.

@hsbt hsbt added rubygems: bug fix skip old stable Leave out of releases on the old stable line labels Nov 17, 2026
@hsbt
hsbt merged commit ddc6412 into ruby:master Nov 17, 2026
114 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rubygems: bug fix skip old stable Leave out of releases on the old stable line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gem::YAMLSerializer::Parser#parse concats documents

2 participants