ruby/racc

Embedded parser mode fails on JRuby due to loaded feature diffs

Closed this issue · 2 comments

The "embedded" mode that inlines racc sources fails to work on JRuby due to differences in how Ruby "loaded features" are managed. This leads to the following test failures:

Failure:
Racc::TestRaccCommand#test_echk_y [/Users/headius/projects/racc/test/test_racc_command.rb:50]:
LoadError: no such file to load -- racc/info
      require at org/jruby/RubyKernel.java:976
      require at /Users/headius/projects/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:59
       (eval) at racc/parser.rb:10
  module_eval at org/jruby/RubyModule.java:3054
       <main> at test/tab/echk:48

This happens because loaded features in JRuby are currently usually the full system path to the relevant file. The embedding logic attempts to short circuit e.g. racc/info by inserting racc/info.rb into the loaded features global.

This is a bug in JRuby but I am filing this to discuss whether we might come up with a more robust way to embed those sources, such as actually removing all requires rather than modifying loaded features directly.

Relates to #93.

Is this still a thing?

hsbt commented

@headius I'll close this. If you still have any issue, Please ping me.