You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on #6561 , I found that if I try to use a bundle subcommand that supports auto_install, and the bundle contains a version of a stdlib that bundler uses but is a different version from what is in the stdlib, then the command will successfully auto_install, but then fail to actually run because a different version of the gem has been activated.
Subsequent calls do work.
Did you try upgrading rubygems & bundler?
Yes, tested on rubygems 3.4.18 and bundler 2.4.18.
I've also bundler tested on master while working on #6561
Post steps to reproduce the problem
Create a Gemfile:
# frozen_string_literal: truesource"https://rubygems.org"# could be anything, just happened to choose thisgem"rubocop"# needs to be something from stdlib that bundler uses# and a version different from what's in the standard gems## see https://stdgems.org/ for current gems & version# ruby 3.2.2 uses 5.0.1, for examplegem"psych","4.0.3"
Run the commands:
bundle config auto_install true# make sure the gem is missing, so auto_install will kick in
gem uninstall rubocop --force --executables
# run something that triggers auto install, ie `bundle exec`
Which command did you run?
Run a bundle subcommand that uses auto_install (ie exec):
$ bundle exec rubocop --version
What were you expecting to happen?
I'd have expected the gems to be installed, and then run the command, ie:
$ bundle exec rubocop --version
1.56.0
What actually happened?
$ bundle exec rubocop --version
Automatically installing missing gems.
Fetching gem metadata from https://rubygems.org/........
Fetching rubocop 1.56.0
Installing rubocop 1.56.0
Bundle complete! 2 Gemfile dependencies, 17 gems now installed.
Use bundle info [gemname] to see where a bundled gem is installed.
bundler: failed to load command: rubocop (/Users/josh.nichols/.rbenv/versions/3.2.2/bin/rubocop)
/Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/runtime.rb:304:in check_for_activated_spec!': You have already activated psych 5.1.0, but your Gemfile requires psych 4.0.3. Prepending bundle exec to your command may solve this. (Gem::LoadError)
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/runtime.rb:25:in block in setup'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/spec_set.rb:165:in each'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/spec_set.rb:165:in each'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/runtime.rb:24:in map'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/runtime.rb:24:in setup'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler.rb:162:in setup'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/setup.rb:10:in block in <top (required)>'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/ui/shell.rb:159:in with_level'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/ui/shell.rb:111:in silence'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/setup.rb:10:in <top (required)>'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/cli/exec.rb:56:in require_relative'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/cli/exec.rb:56:in kernel_load'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/cli/exec.rb:23:in run'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/cli.rb:492:in exec'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/vendor/thor/lib/thor/command.rb:27:in run'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in invoke_command'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/vendor/thor/lib/thor.rb:392:in dispatch'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/cli.rb:34:in dispatch'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/vendor/thor/lib/thor/base.rb:485:in start'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/cli.rb:28:in start'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/exe/bundle:37:in block in <top (required)>'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/lib/bundler/friendly_errors.rb:117:in with_friendly_errors'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.18/exe/bundle:29:in <top (required)>'
from /Users/josh.nichols/.rbenv/versions/3.2.2/bin/bundle:25:in load'
from /Users/josh.nichols/.rbenv/versions/3.2.2/bin/bundle:25:in <main>'
Environment
Bundler 2.4.18
Platforms ruby, arm64-darwin-22
Ruby 3.2.2p53 (2023-03-30 revision e51014f9c05aa65cbf203442d37fef7c12390015) [arm64-darwin-22]
Full Path /Users/josh.nichols/.rbenv/versions/3.2.2/bin/ruby
Config Dir /Users/josh.nichols/.rbenv/versions/3.2.2/etc
RubyGems 3.4.12
Gem Home /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0
Gem Path /Users/josh.nichols/.gem/ruby/3.2.0:/Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0
User Home /Users/josh.nichols
User Path /Users/josh.nichols/.gem/ruby/3.2.0
Bin Dir /Users/josh.nichols/.rbenv/versions/3.2.2/bin
Tools
Git 2.41.0
RVM not installed
rbenv rbenv 1.2.0
chruby
Bundler Build Metadata
Built At 2023-08-02
Git SHA d2e3d8e3f4
Released Version true
Bundler settings
auto_install
Set for your local app (/Users/josh.nichols/workspace/auto-install-demo/.bundle/config): true
build.idn-ruby
Set for the current user (/Users/josh.nichols/.bundle/config): "--with-idn-dir=/opt/homebrew/opt/libidn"
gem.changelog
Set for the current user (/Users/josh.nichols/.bundle/config): false
gem.ci
Set for the current user (/Users/josh.nichols/.bundle/config): false
gem.coc
Set for the current user (/Users/josh.nichols/.bundle/config): false
gem.linter
Set for the current user (/Users/josh.nichols/.bundle/config): false
gem.mit
Set for the current user (/Users/josh.nichols/.bundle/config): false
gem.test
Set for the current user (/Users/josh.nichols/.bundle/config): false
unset
Set for the current user (/Users/josh.nichols/.bundle/config): "jobs"
Describe the problem as clearly as you can
While working on #6561 , I found that if I try to use a
bundle
subcommand that supportsauto_install
, and the bundle contains a version of a stdlib that bundler uses but is a different version from what is in the stdlib, then the command will successfully auto_install, but then fail to actually run because a different version of the gem has been activated.Subsequent calls do work.
Did you try upgrading rubygems & bundler?
Yes, tested on rubygems 3.4.18 and bundler 2.4.18.
I've also bundler tested on
master
while working on #6561Post steps to reproduce the problem
Create a
Gemfile
:Run the commands:
Which command did you run?
Run a bundle subcommand that uses auto_install (ie exec):
$ bundle exec rubocop --version
What were you expecting to happen?
I'd have expected the gems to be installed, and then run the command, ie:
$ bundle exec rubocop --version 1.56.0
What actually happened?
Environment
Bundler Build Metadata
Bundler settings
Gemfile
Gemfile
Gemfile.lock
The text was updated successfully, but these errors were encountered: