Hiroshi SHIBATA 8ef77c3dfe [ruby/rubygems] Load the worktree RubyGems in the dev binstubs
After flattening, lib/ holds both RubyGems and Bundler, so any dev binstub
that puts the worktree lib/ on $LOAD_PATH now overlays the already-booted
system RubyGems with the worktree one. bin/bundle hit this through the
Bundler gemspec activation: the partial overlay mixed a worktree Gem with
an older system Gem::ConfigFile, breaking native extension installs on Ruby
3.2/3.3 (undefined install_extension_in_lib) and corrupting spec names
elsewhere. The same overlay breaks bin/rake, bin/ronn, bin/rubocop and
bin/mdl, which unshift the worktree lib/ (or require it through
rubygems_ext) but boot on the system RubyGems. On a host whose RubyGems
differs from the worktree copy this double-loads files like rubygems/package
and raises (undefined method `spec=' for class Gem::Package::Old).

Route all of them through switch_rubygems, like bin/rspec and bin/test-unit
already do, so they re-exec onto the worktree RubyGems before anything is
loaded. Point the shared gem home job at the worktree copy too, since the
dev binstub can no longer load a separately installed RubyGems, and the
matrix is redundant for now.

https://github.com/ruby/rubygems/commit/f50eb4216d
2026-06-24 14:43:37 +09:00
..