uninitialized constant Tilt::Dummy on special conditions
kamaradclimber opened this issue · comments
Hello,
I started to encounter a special error after upgrading to ruby 2.7.2p137 (ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
)
It seems the error happens in very special conditions:
Preparation:
mkdir realdir
cd realdir
echo "source 'https://rubygems.org'
gem 'sinatra'" > Gemfile
bundle install --standalone
cd ..
ln -s realdir symdir
cd symdir
Command to reproduce: ruby -r $(pwd)/bundle/bundler/setup.rb -e 'require "tilt/mapping"'
What is expected: nothing should appear, process should exit with 0.
What happens:
Traceback (most recent call last):
8: from -e:1:in `<main>'
7: from /usr/lib64/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
6: from /usr/lib64/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
5: from /home/g.seux/symdir/bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/mapping.rb:3:in `<top (required)>'
4: from /home/g.seux/symdir/bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/mapping.rb:50:in `<module:Tilt>'
3: from /home/g.seux/symdir/bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/mapping.rb:262:in `<class:Mapping>'
2: from /usr/lib64/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
1: from /usr/lib64/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
/home/g.seux/symdir/bundle/ruby/2.7.0/gems/tilt-2.0.10/lib/tilt/dummy.rb:2:in `<top (required)>': uninitialized constant Tilt::Dummy (NameError)
- when running
ruby -r ./bundle/bundler/setup.rb -e 'require "tilt/mapping"'
instead, the command works fine. - when running the command from the realdir (not the symlink), the command works fine.
This behavior did not happen when I was running with ruby 2.5.
It seems very specific and I hope it is reproducable outside of my environment.
I looked into this, and don't think we need Tilt::Dummy
anymore. It was originally added to work around JRuby autoload issues in JRuby 9.0.4.0 (see jruby/jruby#3585), but I tested JRuby 9.0.5.0 and the problem appears to have been resolved by then. It seems like a small release, but there were 1548 commits between 9.0.4.0 and 9.0.5.0.
I think we should remove the Tilt::Dummy/AUTOLOAD_IS_BROKEN code. That should fix this issue. I'll submit a pull request for that.