summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorEdouard CHIN <chin.edouard@gmail.com>2026-01-15 17:09:35 +0100
committergit <svn-admin@ruby-lang.org>2026-01-26 08:48:22 +0000
commitace5b10de44acc7ce7717d4109beaeba9a130700 (patch)
treec2a5f41b1764fe4035600ee6a4feb0dc01386294 /test/ruby
parentb3cca1e201238def12f57a9ad21da8ef65ad3563 (diff)
[ruby/rubygems] Fix Bundler that re-exec $0 when a `version` is present in the config:
- ### Problem If you have a `version` in your config file (this feature was introduced in #6817), then running any `bundle` command will make Bundler re-exec and ultimately run the `bundle` binstub twice. ### Details When the `bundle` binstub gets executed, a `require "bundler"` is evaluated. RubyGems tries to require the `bundler.rb` file from the right `bundler` gem (in the event where you have multiple bundler versions in your system). RubyGems will prioritize a bundler version based on a few heurisitics. https://github.com/ruby/rubygems/blob/b50c40c92abb00bb172f1579356cc73c242b1849/lib/rubygems/bundler_version_finder.rb#L19-L21 This prioritize logic doesn't take into account the bundler version a user has specific in this config. So what happens is: 1. User execute the `bundle` binstub 2. `require 'bundler'` is evaluated. 3. RubyGems prioritize activating the bundler version specified in the Gemfile.lock 4. The CLI starts, and [Auto switch kicks in](https://github.com/ruby/rubygems/blob/b50c40c92abb00bb172f1579356cc73c242b1849/bundler/lib/bundler/cli.rb#L81). Bundler detects that user specifed a version in its config and the current Bundler version doesn't match. 5. Bundler exit and re-exec with the right bundler version. ### Solution This patch introduce two fixes. First, it reads the bundler config file and check for the local config first and then the global config. This is because the local has precedence over global. Second, the prioritization takes into account the version in config and let RubyGems activate the right version in order to prevent re-exec moments later. Finally, I also want to fix this problem because its a step toward fixing https://github.com/ruby/rubygems/issues/8106. I'll open a follow up patch to explain. https://github.com/ruby/rubygems/commit/d6e0f43133
Diffstat (limited to 'test/ruby')
0 files changed, 0 insertions, 0 deletions