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

rails command loads the default Bundler 1.17.2 instead of newer installed Bundler 2.1.4 #1987

Closed
deepj opened this issue Apr 20, 2020 · 12 comments
Assignees
Milestone

Comments

@deepj
Copy link

deepj commented Apr 20, 2020

truffleruby 20.1.0-dev-cafc1a20, like ruby 2.6.5, GraalVM CE Native [x86_64-darwin]
git clone https://github.com/chatwoot/chatwoot.git
cd chatwoot
gem install bundler
bundle install
yarn
rails db:migrate

Note: Comment out ruby version in Gemfile before bundle install

TruffleRuby:

You must use Bundler 2 or greater with this lockfile.
$ gem list | grep bundler
bundler (2.1.4, default: 1.17.2)

Ruby 2.7

Model files unchanged.
$ gem list | grep bundler
bundler (2.1.4)
@deepj
Copy link
Author

deepj commented Apr 20, 2020

@eregon this can be interesting. This happens after updating TruffleRuby nightly. It's interesting why so many times is nokogiri "loaded" https://gist.github.com/deepj/6b76683ec473607d950473f785032579

@eregon
Copy link
Member

eregon commented Apr 21, 2020

It would be more interesting to compare to CRuby 2.6, 2.7 only has Bundler 2 and so many other changes, so it's not really comparable. I'll try to reproduce.

@eregon eregon self-assigned this Apr 21, 2020
@deepj
Copy link
Author

deepj commented Apr 21, 2020

@eregon the situation is identical with 2.6

$ ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]
$ gem list | grep bundler
bundler (2.1.4, default: 1.17.2)
$ rails db:migrate
Model files unchanged.

@eregon
Copy link
Member

eregon commented Apr 21, 2020

I can reproduce with just:

# Gemfile
source 'https://rubygems.org'
gem "path"

# test.rb
require 'bundler/setup'
p Bundler::VERSION
$ gem install bundler
$ bundle install
$ ruby test.rb
You must use Bundler 2 or greater with this lockfile.

I'll need to find out what selects Bundler 2 on MRI in this case, and what happens in the opposite case (if the Gemfile.lock is v1)

@bjfish
Copy link
Contributor

bjfish commented Apr 24, 2020

@eregon applying this change should fix this:
rubygems/rubygems@8cbba23

@deepj
Copy link
Author

deepj commented Apr 24, 2020

@eregon I can confirm the @bjfish's suggested commit fixes this issue

$ rails c
Loading development environment (Rails 6.0.2.2)
[1] pry(main)> RUBY_DESCRIPTION
=> "truffleruby 20.2.0-dev-b9a3868f, like ruby 2.6.5, GraalVM CE Native [x86_64-darwin]"

@eregon
Copy link
Member

eregon commented Apr 25, 2020

@bjfish Nice find! How did you find out this commit was needed?
I confirm it fixes my simple reproducer above, could you make a PR with that fix and add some test to make sure it doesn't regress?

@bjfish
Copy link
Contributor

bjfish commented Apr 26, 2020

@eregon A little debugging and I recognized the issue from before I think when rubygems tests were picking up our version of rubygems. So, this may be covered by rubygems tests: https://github.com/rubygems/rubygems/pull/3499/files#diff-254db4345cc461121a9d4dbfd390bc25R385

@bjfish
Copy link
Contributor

bjfish commented Apr 27, 2020

@eregon Yes, I'm make a PR with the fix.

@deepj
Copy link
Author

deepj commented May 3, 2020

@eregon I guess this is fixed

@eregon
Copy link
Member

eregon commented May 4, 2020

@deepj Right, it seems this issue's example works now. We're adding a test for it and that revealed we need to fix #1956 too, which is in progress. Let's close this issue when the test is merged and passing.

@eregon eregon added this to the 20.2.0 milestone May 4, 2020
@eregon
Copy link
Member

eregon commented May 4, 2020

Test added in b9669c4

@eregon eregon closed this as completed May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants