Fix Ruby 4.0 bundle install permission error#2832
Closed
ksss wants to merge 2 commits intoruby:masterfrom
Closed
Conversation
Ruby 4.0.1 CI jobs are failing with this error: ``` Bundler cannot reinstall erb-6.0.1 because there's a previous installation of it at /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/gems/4.0.0/gems/erb-6.0.1 that is unsafe to remove. The parent of /opt/hostedtoolcache/Ruby/4.0.1/x64/lib/ruby/gems/4.0.0/gems/erb-6.0.1 is world-writable and does not have the sticky bit set, making it insecure to remove due to potential vulnerabilities. ``` This is caused by GitHub Actions runner image having improper permissions for Ruby 4.0.1's gem directory. This is similar to the issue that was fixed for Ruby 3.2 in 2024: - ruby/setup-ruby#624 - actions/runner-images#10215 Workaround: Set bundle path to vendor/bundle to avoid using the problematic system gem directory. This is a temporary fix until the upstream issue is resolved. Co-Authored-By: Claude <noreply@anthropic.com>
Using 'bundle config set --local path' caused issues with multiple Gemfile setups (root Gemfile and steep/Gemfile). The environment variable approach is cleaner and doesn't persist configuration to .bundle/config. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Ruby 4.0.1 CI jobs fail with permission error when trying to reinstall erb:
Failed run: https://github.com/ruby/rbs/actions/runs/21500893368/job/61946774227
Solution
Set
BUNDLE_PATHtovendor/bundleto avoid the problematic system gem directory.This is a temporary workaround. Similar issue occurred with Ruby 3.2 and was resolved upstream:
bundle installwith cached Ruby version fails actions/runner-images#10215