-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
bundler/inline: perform installation from a forked child #7941
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
base: master
Are you sure you want to change the base?
Conversation
754c404 to
e715b14
Compare
e715b14 to
72db816
Compare
Unless of course fork isn't available. Alternate: ruby#7930, ruby#7933 Fix: ruby#7930, ruby#7933 When bundler inline has to install gems, it loads more dependencies than when it goes through the fast path of all gems being installed. One of them is `securerandom` so if trying to use bundler/inline with a gem that have a dependency on securerandom that don't match the default version, the script fails with `Gem::LoadError`. This can be preproduced on Ruby 3.2.x, after making sure to `gem uninstall securerandom` so only the default gem remains, and then running the following script: ```ruby require 'bundler/inline' gemfile do source 'https://rubygems.org' gem 'activesupport', '7.2.0' # depends on securerandom >= 0.3 end require 'securerandom' ```
72db816 to
c9c77d2
Compare
| # If the install succeeded, we need to refresh gem info | ||
| Bundler.reset! | ||
|
|
||
| builder = Bundler::Dsl.new | ||
| builder.instance_eval(&gemfile) | ||
| builder.check_primary_source_safety | ||
|
|
||
| definition = builder.to_definition(nil, true) | ||
| def definition.lock(*); end | ||
| definition.validate_runtime! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course it's harder than I expected, because since the install is done in a subprocess the parent need to refresh the gem info. I'm super un-familiar with rubygems/bundler do I don't know what the clean way of doing this, but it seems to work except for native gems :/
There is 3 failing specs left I don't know how to fix:
rspec ./spec/runtime/inline_spec.rb:193 # bundler/inline#gemfile installs subdependencies quietly if necessary when the install option is not set, and multiple sources used
rspec ./spec/runtime/inline_spec.rb:218 # bundler/inline#gemfile installs quietly from git if necessary when the install option is not set
rspec ./spec/runtime/inline_spec.rb:323 # bundler/inline#gemfile installs gems with native extensions in later gemfile calls
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| else | ||
| do_install.call | ||
| end | ||
| end |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Unless of course fork isn't available.
Alternate: #7930, #7933
Fix: #7930, #7933
When bundler inline has to install gems, it loads more dependencies than when it goes through the fast path of all gems being installed.
One of them is
securerandomso if trying to use bundler/inline with a gem that have a dependency on securerandom that don't match the default version, the script fails withGem::LoadError.This can be preproduced on Ruby 3.2.x, after making sure to
gem uninstall securerandomso only the default gem remains, and then running the following script: