From b722d37f21ff0b148bdadb1b6aed6532f9beb9bf Mon Sep 17 00:00:00 2001 From: Edouard CHIN Date: Mon, 12 Jan 2026 15:09:36 +0100 Subject: [ruby/rubygems] Add a missing "require 'etc'" statement: - Ref https://github.com/ruby/rubygems/pull/9171#discussion_r2658056892 - Referencing the constant Etc may raise a `NameError` depending on whether other Rubygems/Bundler codepath have evaluated a prior "require 'etc'". This can be reproduced with this Gemfile: ```ruby source "https://rubygems.org" gem 'prism', github: "ruby/prism" ``` https://github.com/ruby/rubygems/commit/5d435e6863 --- lib/rubygems/installer.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index 90aa25dc07..914e413677 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -943,7 +943,12 @@ class Gem::Installer end def build_jobs - @build_jobs ||= Etc.nprocessors + 1 + @build_jobs ||= begin + require "etc" + Etc.nprocessors + 1 + rescue LoadError + 1 + end end def rb_config -- cgit v1.2.3