Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundler activates minitest from stdlib instead of installed gem after upgrading to RubyGems 2.7.5 #5038

Closed
philr opened this issue Feb 10, 2018 · 3 comments

Comments

@philr
Copy link
Contributor

philr commented Feb 10, 2018

I'm not sure yet whether this is an issue with JRuby, Bundler or RubyGems, but I've so far only encountered the problem with JRuby.

With a clean install of JRuby 9.1.15.0 and a Gemfile containing gem "minitest", "5.11.3", Bundler will activate the minitest 5.11.3 gem as expected. After upgrading to RubyGems 2.7.5, Bundler incorrectly activates the built-in version of minitest from stdlib instead.

With a clean JRuby 9.1.15.0 install:

$ uname -a
Linux linuxdev 4.10.0-42-generic #46-Ubuntu SMP Mon Dec 4 14:38:01 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ jruby -v
jruby 9.1.15.0 (2.3.3) 2017-12-07 929fde8 OpenJDK 64-Bit Server VM 25.151-b12 on 1.8.0_151-8u151-b12-0ubuntu0.17.04.2-b12 +jit [linux-x86_64]
$ gem --version
2.6.14

Install bundler 1.16.1:

$ gem install bundler -v1.16.1
Fetching: bundler-1.16.1.gem (100%)
Successfully installed bundler-1.16.1
1 gem installed

Create and switch to a directory for testing:

$ mkdir /tmp/issue5038 && cd /tmp/issue5038 

Create a Gemfile, add minitest 5.11.3 and install:

$ bundle init && bundle add minitest -v 5.11.3
Writing new Gemfile to /tmp/gemissue/Gemfile
Fetching gem metadata from https://rubygems.org/.............
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/.............
Using bundler 1.16.1
Fetching minitest 5.11.3
Installing minitest 5.11.3

Run a test to confirm that the correct version of minitest gets loaded (5.11.3) and that the load path is ordered appropriately:

$ bundle exec jruby -rminitest -e'puts Minitest::VERSION; p $:'
5.11.3
["/tmp/jruby-9.1.15.0/lib/ruby/gems/shared/gems/bundler-1.16.1/lib",
 "/tmp/jruby-9.1.15.0/lib/ruby/gems/shared/gems/minitest-5.11.3/lib",
 "/tmp/jruby-9.1.15.0/lib/ruby/2.3/site_ruby",
 "/tmp/jruby-9.1.15.0/lib/ruby/stdlib"]

Upgrade to RubyGems 2.7.5:

$ gem update --system 2.7.5
Updating rubygems-update
Fetching: rubygems-update-2.7.5.gem (100%)
Successfully installed rubygems-update-2.7.5
Installing RubyGems 2.7.5
Bundler 1.16.1 installed
RubyGems 2.7.5 installed
Regenerating binstubs
RubyGems system software updated

Re-run the test. This now (incorrectly) outputs the version of the built-in version of minitest (5.4.1). The stdlib directory is now ahead of the minitest gem in the load path.

$ bundle exec jruby -rminitest -e'puts Minitest::VERSION; p $:'
5.4.1
["/tmp/jruby-9.1.15.0/lib/ruby/stdlib",
 "/tmp/jruby-9.1.15.0/lib/ruby/gems/shared/gems/minitest-5.11.3/lib",
 "/tmp/jruby-9.1.15.0/lib/ruby/gems/shared/gems/bundler-1.16.1/lib",
 "/tmp/jruby-9.1.15.0/lib/ruby/2.3/site_ruby"]
philr added a commit to tzinfo/tzinfo that referenced this issue Feb 12, 2018
This is a workaround for the test failures in
https://travis-ci.org/tzinfo/tzinfo/jobs/339829912

The underlying issue was an old built-in version of minitest being
loaded instead of the bundled gem (see
jruby/jruby#5038).

Revert c7958d9 and rearrange the load
path if the stdlib directory appears before the minitest gem.
@headius
Copy link
Member

headius commented Feb 13, 2018

Hmm, have you filed this with RubyGems? Given that JRuby doesn't change at all and it stops working, I'd strongly lean toward this being their issue. They have broken this sort of searching before, too.

@philr
Copy link
Contributor Author

philr commented Feb 13, 2018

@headius Thanks for taking a look. I've just filed rubygems/rubygems#2188 to see what they make of this.

@headius
Copy link
Member

headius commented Feb 14, 2018

Ok, we'll call this Invalid for now. If there's something we're doing wrong, let us know and we'll reopen it (and maybe ping us through other channels too).

@headius headius closed this as completed Feb 14, 2018
@headius headius added this to the Invalid or Duplicate milestone Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants