Skip to content

Variable incorrectly nil during rdoc test suite #3377

@eregon

Description

@eregon

Originally reported by @nobu on Slack.

Can be seen at https://github.com/nobu/rdoc/actions/runs/7484932428/job/20372568997#step:6:37
And I could also reproduce locally for ruby/rdoc@4e14158 and
truffleruby 24.0.0-dev-286d3a41, like ruby 3.2.2, GraalVM CE Native [x86_64-linux] 286d3a41.

git clone rdoc
cd rdoc
bundle install
bundle exec rake
==============================================================================================================================
Error: test_can_parse_modeline_c(TestRDocParser): NoMethodError: undefined method `casecmp?' for nil:NilClass
/home/eregon/code/rdoc/lib/rdoc/parser.rb:131:in `block in can_parse_by_name'
<internal:core> core/enumerable.rb:713:in `block in find'
<internal:core> core/enumerable.rb:711:in `each'
<internal:core> core/enumerable.rb:711:in `find'
/home/eregon/code/rdoc/lib/rdoc/parser.rb:131:in `can_parse_by_name'
/home/eregon/code/rdoc/lib/rdoc/parser.rb:108:in `can_parse'
/home/eregon/code/rdoc/test/rdoc/test_rdoc_parser.rb:163:in `test_can_parse_modeline_c'
     160:       io.puts "/* This document explains how to make extension libraries for Ruby. */"
     161:     end
     162: 
  => 163:     assert_equal RDoc::Parser::C, @RP.can_parse(readme_inc)
     164:   ensure
     165:     File.unlink readme_inc
     166:   end
<internal:core> core/throw_catch.rb:36:in `catch'
<internal:core> core/throw_catch.rb:36:in `catch'
==============================================================================================================================

But looking at the code it's clear mode cannot be nil there:
https://github.com/ruby/rdoc/blob/4e14158255ad8de64041105470d88f66b6e22e98/lib/rdoc/parser.rb#L128-L131

Interestingly it happens with export TRUFFLERUBYOPT="--experimental-options --engine.Compilation=false" too.

And it also happens on truffleruby-jvm.
Can be reproduced with just be ruby -Ilib test/rdoc/test_rdoc_parser.rb.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions