rubygems icon indicating copy to clipboard operation
rubygems copied to clipboard

`bundle install` without `development` group crashes when the group contains a plugin

Open rhysd opened this issue 1 year ago • 0 comments

Describe the problem as clearly as you can

bundle install without development group crashes when the group contains any bundler plugin.

Did you try upgrading rubygems & bundler?

Yes:

  • gem --version: 3.5.14
  • bundle --version: Bundler version 2.5.14

Post steps to reproduce the problem

Create a new directory and enter it:

mkdir path/to/dir
cd path/to/dir

Create a Gemfile file with the following content:

source 'https://rubygems.org'

group :development do
  plugin 'bundler_install_stats'
end

Which command did you run?

bundle install --path=.bundle --without development

I know that these options are deprecated, but I used them here to reduce the number of steps to reproduce.

What were you expecting to happen?

bundle install is successfully done without installing any plugins/gems.

What actually happened?

The command crashed with the following report template:

NoMethodError: undefined method `full_gem_path' for nil
  /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/plugin.rb:284:in `save_plugin'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/plugin.rb:260:in `block in save_plugins'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/plugin.rb:255:in `each'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/plugin.rb:255:in `save_plugins'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/plugin.rb:119:in `block in gemfile_install'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/settings.rb:158:in `temporary'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/plugin.rb:104:in `gemfile_install'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/cli/install.rb:58:in `run'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/cli.rb:247:in `block in install'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/settings.rb:158:in `temporary'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/cli.rb:246:in `install'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/cli.rb:35:in `dispatch'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/cli.rb:29:in `start'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/exe/bundle:28:in `block in <top (required)>'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/site_ruby/3.3.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
          /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/exe/bundle:20:in `<top (required)>'
          /Users/rhysd/.rbenv/versions/3.3.3/bin/bundle:25:in `load'
          /Users/rhysd/.rbenv/versions/3.3.3/bin/bundle:25:in `<main>'

Environment

Bundler       2.5.14
  Platforms   ruby, x86_64-darwin-22
Ruby          3.3.3p89 (2024-06-12 revision f1c7b6f435f1167a0514b39a5f72f55cec4d1426) [x86_64-darwin-22]
  Full Path   /Users/rhysd/.rbenv/versions/3.3.3/bin/ruby
  Config Dir  /Users/rhysd/.rbenv/versions/3.3.3/etc
RubyGems      3.5.14
  Gem Home    /Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0
  Gem Path    /Users/rhysd/.gem/ruby/3.3.0:/Users/rhysd/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0
  User Home   /Users/rhysd
  User Path   /Users/rhysd/.gem/ruby/3.3.0
  Bin Dir     /Users/rhysd/.rbenv/versions/3.3.3/bin
OpenSSL
  Compiled    OpenSSL 3.3.1 4 Jun 2024
  Loaded      OpenSSL 3.3.1 4 Jun 2024
  Cert File   /usr/local/etc/openssl@3/cert.pem
  Cert Dir    /usr/local/etc/openssl@3/certs
Tools
  Git         2.44.0
  RVM         not installed
  rbenv       rbenv 1.2.0
  chruby      not installed

Bundler Build Metadata

Built At          2024-06-21
Git SHA           72920bc230
Released Version  true

Bundler settings

path
  Set for your local app (/Users/rhysd/Develop/github.com/rhysd/tmp/.bundle/config): ".bundle"
without
  Set for your local app (/Users/rhysd/Develop/github.com/rhysd/tmp/.bundle/config): [:development]

Gemfile

Gemfile

source 'https://rubygems.org'

group :development do
  plugin 'bundler_install_stats'
end

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:

PLATFORMS
  ruby
  x86_64-darwin-22

DEPENDENCIES

BUNDLED WITH
   2.5.14

If not included with the output of your command, run bundle env and paste the output below

It is included in the previous section.

rhysd avatar Jun 29 '24 12:06 rhysd