Skip to content

Gem::YAMLSerializer.load doesn't recognize double quote #9551

@kou

Description

@kou

Describe the problem as clearly as you can

Gem::YAMLSerializer.load ignores double quoted string:

require "rubygems/yaml_serializer"

pp Gem::YAMLSerializer.load(<<-YAML)
requirements:
  - "system: arrow-glib>=25.0.0: amazon_linux: arrow-glib-devel"
YAML
# => {"requirements" => [{"\"system" => "arrow-glib>=25.0.0: amazon_linux: arrow-glib-devel\""}]}

This must be parsed as {"requirements" => ["system: arrow-glib>=25.0.0: amazon_linux: arrow-glib-devel"]}.

Did you try upgrading RubyGems?

Yes. I'm using master.

Post steps to reproduce the problem

Run the above reproduce program.

Which command did you run?

gem install with https://github.com/ruby-gnome/rubygems-requirements-system/ . It uses spec.requirements and assumes that spec.requirements return [String] not [Hash].

What were you expecting to happen?

Double quote is parsed correctly.

What actually happened?

Double quote is ignored.

Run gem env and paste the output below

RubyGems Environment:
  - RUBYGEMS VERSION: 4.1.0.dev
  - RUBY VERSION: 4.1.0 (2026-05-02 patchlevel -1) [x86_64-linux]
  - INSTALLATION DIRECTORY: /var/tmp/local/lib/ruby/gems/4.1.0+1
  - USER INSTALLATION DIRECTORY: /home/kou/.gem/ruby/4.1.0+1
  - CREDENTIALS FILE: /home/kou/.gem/credentials
  - RUBYGEMS PREFIX: /home/kou/work/ruby/rubygems
  - RUBY EXECUTABLE: /var/tmp/local/bin/ruby
  - GIT EXECUTABLE: /bin/git
  - EXECUTABLE DIRECTORY: /var/tmp/local/bin
  - SPEC CACHE DIRECTORY: /home/kou/.cache/gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /var/tmp/local/etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - x86_64-linux
  - GEM PATHS:
     - /var/tmp/local/lib/ruby/gems/4.1.0+1
     - /home/kou/.gem/ruby/4.1.0+1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => true
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /var/tmp/local/bin
     - /bin
     - /usr/local/bin
     - /usr/bin
     - /usr/games

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions