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

Fix rubygems update when non default --install-dir is configured #5566

Merged
merged 1 commit into from May 28, 2022

Conversation

deivid-rodriguez
Copy link
Member

@deivid-rodriguez deivid-rodriguez commented May 25, 2022

What was the end-user or developer problem that led to this PR?

If RubyGems is configured with a non default --install-dir, gem update --system will fail because it tries to switching to the rubygems-update installation folder in the default gem dir, and the gem is not there.

What is your fix for the problem, implemented in this PR?

Use spec.base_dir of the installed updater gem, instead of always using Gem.dir.

Fixes #5541.

Make sure the following tasks are checked

@deivid-rodriguez deivid-rodriguez force-pushed the rubygems-update-fix branch 2 times, most recently from ef57b25 to 372fdcc Compare May 26, 2022 12:02
@deivid-rodriguez deivid-rodriguez marked this pull request as ready for review May 26, 2022 13:20
@deivid-rodriguez deivid-rodriguez merged commit 0281130 into master May 28, 2022
@deivid-rodriguez deivid-rodriguez deleted the rubygems-update-fix branch May 28, 2022 10:22
deivid-rodriguez added a commit that referenced this pull request Jun 1, 2022
Fix rubygems update when non default `--install-dir` is configured

(cherry picked from commit 0281130)
@brettcurtis
Copy link

Is this problem back again?

RubyGems Environment:
  - RUBYGEMS VERSION: 3.3.8
  - RUBY VERSION: 3.1.3 (2022-11-24 patchlevel 185) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/lib64/ruby/gems/3.1.0
  - USER INSTALLATION DIRECTORY: /root/.local/share/gem/ruby/3.1.0
  - RUBY EXECUTABLE: /usr/bin/ruby31
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /usr/bin
  - SPEC CACHE DIRECTORY: /root/.local/share/gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - x86_64-linux
  - GEM PATHS:
     - /usr/lib64/ruby/gems/3.1.0
     - /root/.local/share/gem/ruby/3.1.0
     - /usr/local/lib64/ruby/gems/3.1.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "install" => "--install-dir /usr/local/lib64/ruby/gems/3.1.0 --bindir /usr/local/bin"
     - "uninstall" => "--install-dir /usr/local/lib64/ruby/gems/3.1.0 --bindir /usr/local/bin"
     - "update" => "--install-dir /usr/local/lib64/ruby/gems/3.1.0 --bindir /usr/local/bin"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/brett/google-cloud-sdk/bin
     - /home/brett/google-cloud-sdk/bin
     - /home/brett/bin
     - /home/brett/go/bin
     - /home/brett/.local/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /opt/bin
❯ sudo gem update --system
Updating rubygems-update
Fetching rubygems-update-3.3.26.gem
Successfully installed rubygems-update-3.3.26
ERROR:  While executing gem ... (Errno::ENOENT)
    No such file or directory @ dir_chdir - /usr/lib64/ruby/gems/3.1.0/gems/rubygems-update-3.3.26

@deivid-rodriguez
Copy link
Member Author

I think the explanation is that you need the initial version of RubyGems to have the fix, and the fix was released with 3.3.15 but you are upgrading from 3.3.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gem update --system ERROR: While executing gem ... (Errno::ENOENT)
2 participants