Rubygems: gem env command not working after Rubygems 3.1.1 upgrade

Created on 16 Dec 2019  路  5Comments  路  Source: rubygems/rubygems

I'm having a problem or would like to suggest a feature.

My current problem is that gem env is not working after 3.1.1 upgrade.

This issue is related to:

  • [ ] Network problems
  • [ ] Installing a library
  • [ ] Publishing a library
  • [x] The command line gem
  • [ ] Other

Here are my current environment details:

$ gem env version
3.1.1

Upgrading to rubygems 3.1.1 breaks gem env command.

Steps to reproduce:
Run ruby docker image: docker run -it --rm ruby:2.3 bash
gem env works:

root@82cc6a0bdd6d:/# gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 3.0.3
  - RUBY VERSION: 2.3.8 (2018-10-18 patchlevel 459) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/bundle
  - USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /usr/local/bundle/bin
  - SPEC CACHE DIRECTORY: /root/.gem/specs
.....

Run gem update --system:

root@82cc6a0bdd6d:/# gem update --system
Updating rubygems-update
Fetching rubygems-update-3.1.1.gem
Successfully installed rubygems-update-3.1.1
Installing RubyGems 3.1.1
  Successfully built RubyGem
  Name: bundler
  Version: 2.1.0
  File: bundler-2.1.0.gem
bundler's executable "bundle" conflicts with /usr/local/bin/bundle
Overwrite the executable? [yN]  y
Bundler 2.1.0 installed
RubyGems 3.1.1 installed
....

gem env throws a uninitialized constant Gem::SourceList::URI error

root@82cc6a0bdd6d:/# gem env
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::SourceList::URI

I will abide by the code of conduct.

bug report

Most helpful comment

@mihaibuzgau Thanks for your patch. I will release it with RubyGems 3.1.2 in a few days.

All 5 comments

Thanks. It seems a bug with RubyGems 3.1.

source of the issue seems to be when you overwrites bundler executable (everythign I'm using relies on 1.17.x:

gem update --system                                                                                                                                                              
Updating rubygems-update
Fetching rubygems-update-3.1.1.gem
Successfully installed rubygems-update-3.1.1
Parsing documentation for rubygems-update-3.1.1
Installing ri documentation for rubygems-update-3.1.1
Installing darkfish documentation for rubygems-update-3.1.1
Done installing documentation for rubygems-update after 238 seconds
Parsing documentation for rubygems-update-3.1.1
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 3.1.1
  Successfully built RubyGem
  Name: bundler
  Version: 2.1.0
  File: bundler-2.1.0.gem
bundler's executable "bundle" conflicts with /Users/brodock/.rvm/rubies/ruby-2.6.3/bin/bundle
Overwrite the executable? [yN]  y
Bundler 2.1.0 installed
RubyGems 3.1.1 installed
Regenerating binstubs
Parsing documentation for rubygems-3.1.1
Installing ri documentation for rubygems-3.1.1

If I ignore the overwriting, update fails:

Updating rubygems-update
Successfully installed rubygems-update-3.1.1
Parsing documentation for rubygems-update-3.1.1
Done installing documentation for rubygems-update after 0 seconds
Parsing documentation for rubygems-update-3.1.1
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 3.1.1
  Successfully built RubyGem
  Name: bundler
  Version: 2.1.0
  File: bundler-2.1.0.gem
bundler's executable "bundle" conflicts with /Users/brodock/.rvm/rubies/ruby-2.6.3/bin/bundle
Overwrite the executable? [yN]  n
ERROR:  While executing gem ... (Gem::InstallError)
    "bundle" from bundler conflicts with /Users/brodock/.rvm/rubies/ruby-2.6.3/bin/bundle

but it gets it through and it is broken again.

@mihaibuzgau Thanks for your patch. I will release it with RubyGems 3.1.2 in a few days.

@hsbt after doing additional testing, there still seems to be a problem with gem env command, I will open a PR shortly, should I create a new issue?

Was this page helpful?
0 / 5 - 0 ratings