-
Notifications
You must be signed in to change notification settings - Fork 446
Description
Hello, as a preface I am a bit out of my depth here, so I hope you can bare with me.
Problem
When I use the utility ri to view core and standard library documentation, either directly from the command-line, IRB, or from within a ruby file, I get a Marshal.load error, telling me that it can't unpack the RDoc::Markup::Heading class because it isn't a struct (more info below). This happens for all stdlib or core library names. Additionally, when using IRB, it seems that when IRB tries to fetch the documentation for various names/methods, it tries to load the documentation with rdoc and this is causing IRB to crash with the same error.
This problem seems specific to rdoc version 7.0.3. I have other (older) versions of ri/rdoc including 7.0.1, 6.17.0, 6.16.1, 6.16.0, 6.15.1 which all seem to work, and using the following command I am able to load documentation using ri without any problem:
ri _7.0.1_ Hash # This works fine and produces the rdoc info for the Hash class in my shell's default pagerSteps to reproduce the problem:
- run
ri Hashat the command line (bash) - run
ri Hashfrom within IRB - start IRB at the command-line, start typing
Hash, tab down to highlight the "Hash" entry in the completion-suggestion dropdown, and wait for IRB to crash - in a file,
require rdoc/ri/driverand executeRdoc::RI::Driver.new.display_name "Hash"
All of the above produce the following error:
<internal:marshal>:34:in 'Marshal.load': class RDoc::Markup::Heading not a struct (TypeError)
Diagnostic Info
Here is a ruby script to print my system info, as well as a snippet that reproduces the exact error I get in all cases mentioned above:
require 'rdoc'
require 'rdoc/ri/driver'
puts "Ruby version: #{RUBY_VERSION}"
puts "Ruby patchlevel: #{RUBY_PATCHLEVEL}"
puts "Ruby platform: #{RUBY_PLATFORM}"
puts "RDoc version: #{RDoc::VERSION}"
puts "RDoc file: #{RDoc.const_source_location :VERSION}"
puts "My RI paths:"
RDoc::RI::Paths.each { |path| puts " #{path}" }
3.times { puts }
puts 'MY ERROR:'
begin
RDoc::RI::Driver.new.display_name 'Hash'
rescue => e
puts e.full_message
endAnd here is the corresponding output (in a dropdown because its long):
Details
Ruby version: 3.4.6
Ruby patchlevel: 54
Ruby platform: x86_64-linux
RDoc version: 7.0.3
RDoc file: ["/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rdoc-7.0.3/lib/rdoc/version.rb", 8]
My RI paths:
/home/scriabin/.rbenv/versions/3.4.6/share/ri/3.4.0/system
/home/scriabin/.rbenv/versions/3.4.6/share/ri/3.4.0/site
/home/scriabin/.local/share/rdoc
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/action_text-trix-2.1.15/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/actioncable-8.1.1/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/actionmailbox-8.1.1/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/actionmailer-8.1.1/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/actionpack-8.1.1/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/actiontext-8.1.1/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/actionview-8.1.1/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/activejob-8.1.1/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/activemodel-8.1.1/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/activerecord-8.1.1/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/activestorage-8.1.1/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/activesupport-8.1.1/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/ast-2.4.3/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/benchmark-ips-2.14.0/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/lint_roller-1.1.0/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/parallel-1.27.0/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/parser-3.3.10.0/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/rails-8.1.1/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/railties-8.1.1/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/rainbow-3.1.1/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/regexp_parser-2.11.3/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/rubocop-1.81.7/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/rubocop-ast-1.48.0/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/ruby-progressbar-1.13.0/ri
/home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/doc/rubygems-update-4.0.2/ri
MY ERROR:
<internal:marshal>:34:in 'Marshal.load': class RDoc::Markup::Heading not a struct (TypeError)
from /home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rdoc-7.0.3/lib/rdoc/store.rb:982:in 'block in RDoc::Store#marshal_load'
from /home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rdoc-7.0.3/lib/rdoc/store.rb:982:in 'IO.open'
from /home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rdoc-7.0.3/lib/rdoc/store.rb:982:in 'RDoc::Store#marshal_load'
from /home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rdoc-7.0.3/lib/rdoc/store.rb:627:in 'RDoc::Store#load_class_data'
from /home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rdoc-7.0.3/lib/rdoc/store.rb:607:in 'RDoc::Store#load_class'
from /home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rdoc-7.0.3/lib/rdoc/ri/driver.rb:731:in 'block in RDoc::RI::Driver#classes_and_includes_and_extends_for'
from /home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rdoc-7.0.3/lib/rdoc/ri/driver.rb:729:in 'Array#map'
from /home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rdoc-7.0.3/lib/rdoc/ri/driver.rb:729:in 'RDoc::RI::Driver#classes_and_includes_and_extends_for'
from /home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rdoc-7.0.3/lib/rdoc/ri/driver.rb:824:in 'RDoc::RI::Driver#display_class'
from /home/scriabin/.rbenv/versions/3.4.6/lib/ruby/gems/3.4.0/gems/rdoc-7.0.3/lib/rdoc/ri/driver.rb:858:in 'RDoc::RI::Driver#display_name'
from rdoc_test.rb:16:in '<main>'
The error's differ slightly in the different situations, but the core problem seems to be from this call sequence:
RDoc::Store#load_class -> RDoc::Store#load_class_data -> RDoc::Store#marshal_load
Additional Info
I think this may be related: to #1389
Please let me know if there is any more information I can provide, or if there is already a fix available that I haven't been able to find.