Skip to content

Incompatibility with rdoc 7.2.0 and ruby 2.6 #1683

@nevans

Description

@nevans

The current minimum_ruby_version is 2.6, and (for just a little while longer) I still need to support security patches for an old version of gem still needs to support ruby 2.6. I've been using docker run -it -v "$(pwd):$(pwd)" -w "$(pwd)" --rm ruby:2.6 bash for local testing (and GitHub Actions setup/ruby in CI).

But, with rdoc in the Gemfile, bundle install installs the latest version. And, after installing v7.2.0, I get the following error, simply running various gem or bundler commands:

$ gem list rdoc
Error loading RubyGems plugin "/usr/local/bundle/gems/rdoc-7.2.0/lib/rubygems_plugin.rb": hash key "*" is not a Symbol (TypeError)
WARN: Unresolved or ambigious specs during Gem::Specification.reset:
      stringio (>= 0)
      Available/installed versions of this gem:
      - 3.0.6
      - 0.0.2
WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
Please report a bug if this causes problems.

*** LOCAL GEMS ***

rdoc (7.2.0, 7.1.0, 6.17.0, default: 6.1.2.1)

Here's the full stacktrace from rake

$ bundle exec rake --trace
TypeError: hash key "*" is not a Symbol
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markup/inline_parser.rb:38:in `<class:InlineParser>'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markup/inline_parser.rb:10:in `<top (required)>'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markup/formatter.rb:13:in `require'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markup/formatter.rb:13:in `<top (required)>'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markup/to_joined_paragraph.rb:10:in `require'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markup/to_joined_paragraph.rb:10:in `<top (required)>'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markdown.rb:576:in `require_relative'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markdown.rb:576:in `<class:Markdown>'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/markdown.rb:182:in `<top (required)>'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/text.rb:24:in `require'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/text.rb:24:in `<module:Text>'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/text.rb:11:in `<top (required)>'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/code_object.rb:31:in `require'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/code_object.rb:31:in `<class:CodeObject>'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/code_object.rb:29:in `<top (required)>'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/code_object/method_attr.rb:5:in `require'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/code_object/method_attr.rb:5:in `<top (required)>'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/code_object/any_method.rb:5:in `require'
/usr/local/bundle/gems/rdoc-7.2.0/lib/rdoc/code_object/any_method.rb:5:in `<top (required)>'
/home/nick/src/net-imap/rakelib/rdoc.rake:50:in `require'
/home/nick/src/net-imap/rakelib/rdoc.rake:50:in `<top (required)>'
/usr/local/bundle/gems/rake-13.4.2/lib/rake/rake_module.rb:29:in `load'
/usr/local/bundle/gems/rake-13.4.2/lib/rake/rake_module.rb:29:in `load_rakefile'
/usr/local/bundle/gems/rake-13.4.2/lib/rake/default_loader.rb:11:in `load'
/usr/local/bundle/gems/rake-13.4.2/lib/rake/application.rb:804:in `load_imports'
/usr/local/bundle/gems/rake-13.4.2/lib/rake/application.rb:743:in `raw_load_rakefile'
/usr/local/bundle/gems/rake-13.4.2/lib/rake/application.rb:127:in `block in load_rakefile'
/usr/local/bundle/gems/rake-13.4.2/lib/rake/application.rb:209:in `standard_exception_handling'
/usr/local/bundle/gems/rake-13.4.2/lib/rake/application.rb:126:in `load_rakefile'
/usr/local/bundle/gems/rake-13.4.2/lib/rake/application.rb:83:in `block in run'
/usr/local/bundle/gems/rake-13.4.2/lib/rake/application.rb:209:in `standard_exception_handling'
/usr/local/bundle/gems/rake-13.4.2/lib/rake/application.rb:81:in `run'
/usr/local/bundle/gems/rake-13.4.2/exe/rake:27:in `<top (required)>'
/usr/local/bundle/bin/rake:23:in `load'
/usr/local/bundle/bin/rake:23:in `<top (required)>'
/usr/local/bundle/gems/bundler-2.4.22/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/bundle/gems/bundler-2.4.22/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/bundle/gems/bundler-2.4.22/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/bundle/gems/bundler-2.4.22/lib/bundler/cli.rb:492:in `exec'
/usr/local/bundle/gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/usr/local/bundle/gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
/usr/local/bundle/gems/bundler-2.4.22/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/bundle/gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/usr/local/bundle/gems/bundler-2.4.22/lib/bundler/cli.rb:28:in `start'
/usr/local/bundle/gems/bundler-2.4.22/exe/bundle:37:in `block in <top (required)>'
/usr/local/bundle/gems/bundler-2.4.22/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/bundle/gems/bundler-2.4.22/exe/bundle:29:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'

The problem is that ruby 2.6 only hash splatting with ** to work with symbol keys:

$ docker run -it --rm ruby:2.6 ruby -e 'pp({ **{"str" => "str"} })'
-e:1:in `<main>': hash key "str" is not a Symbol (TypeError)
$ docker run -it --rm ruby:2.7 ruby -e 'pp({ **{"str" => "str"} })'
{"str"=>"str"}

So that breaks these lines:

  TOKENS = {
    **WORD_PAIRS.transform_values { [:word_pair, nil] },
    **TAGS.keys.to_h {|tag| ["<#{tag}>", [:open_tag, tag]] },
    **TAGS.keys.to_h {|tag| ["</#{tag}>", [:close_tag, tag]] },
    **CODEBLOCK_TAGS.to_h {|tag| ["<#{tag}>", [:code_start, tag]] },
    **STANDALONE_TAGS.keys.to_h {|tag| ["<#{tag}>", [:standalone_tag, tag]] },
    '{' => [:tidylink_start, nil],
    '}' => [:tidylink_mid, nil],
    '\\' => [:escape, nil],
    '[' => nil # To make `label[url]` scan as separate tokens
  } # :nodoc:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions