It's currently: +++ b/tool/rbinstall.rb 2022-11-13 08:16:09.110406705 +0100 @@ -994,7 +994,7 @@ end install?(:ext, :comm, :gem, :'bundled-gems') do - gem_dir = Gem.default_dir + gem_dir = ENV['GEM_DESTDIR'] install_dir = with_destdir(gem_dir) prepare "bundled gems", gem_dir RbInstall.no_write do It should be: diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index f910fca..2f21884 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -942,7 +942,7 @@ def load_gemspec(file, base = nil) end def install_default_gem(dir, srcdir, bindir) - gem_dir = Gem.default_dir + gem_dir = ENV['GEM_DESTDIR'] install_dir = with_destdir(gem_dir) prepare "default gems from #{dir}", gem_dir RbInstall.no_write do @@ -991,7 +991,7 @@ def install_default_gem(dir, srcdir, bindir) end install?(:ext, :comm, :gem, :'bundled-gems') do - gem_dir = Gem.default_dir + gem_dir = ENV['GEM_DESTDIR'] install_dir = with_destdir(gem_dir) prepare "bundled gems", gem_dir RbInstall.no_write do Tested with ruby-3.2.2-r4.ebuild. As to why I was able to detect this, I use my own "operating_systems.rb" which changes Gem.default_dir to home directory and the value reflected when I installed ruby:3.2. # frozen_string_literal: true module Gem module OperatingSystemDefaults def user_dir gentoo_user_dir end def default_dir gentoo_user_dir end def default_bindir gentoo_user_bindir end def default_path path = [] path << gentoo_user_dir unless gentoo_local_dir == gentoo_user_dir path << gentoo_local_dir path << gentoo_dir path << vendor_dir if vendor_dir && File.directory?(vendor_dir) path end def operating_system_defaults { 'custom_shebang' => '/usr/bin/env ruby' } end def default_specifications_dir @default_specifications_dir ||= File.join(orig_default_dir, "specifications", "default") end private def gentoo_dir @gentoo_dir ||= RbConfig::CONFIG['sitelibdir'].gsub('site_ruby', 'gems') end def gentoo_local_dir @gentoo_local_dir ||= gentoo_dir.gsub('/usr', '/usr/local') end def gentoo_user_dir @gentoo_user_dir ||= Process.euid.zero? ? gentoo_local_dir : orig_user_dir end def gentoo_user_bindir @gentoo_user_bindir ||= Process.euid.zero? ? '/usr/local/bin' : File.join(user_home, 'bin') end def orig_default_dir method(:default_dir).super_method.call end def orig_user_dir method(:user_dir).super_method.call end end self.singleton_class.prepend OperatingSystemDefaults end I first shared it in a Github thread which I can no longer find. It's a bit outdated because it should have the @GENTOO_PORTAGE_EPREFIX@ stuff gentoo-defaults.rb have. Originally it also doesn't override default_specifications_dir but default gems aren't detected unless I add it. It wasn't needed until rubygems' 90c1919f94 commit, probably.
When giving (fixed) patches, please attach them so the formatting is correct.
Created attachment 866531 [details, diff] Patch
> { 'custom_shebang' => '/usr/bin/env ruby' } I'm now testing this to have /usr/bin/ruby in my system instead for the same reason as https://bugs.gentoo.org/911513.