Skip to content

Commit 174b54c

Browse files
Edouard-chinmatzbot
authored andcommitted
[ruby/rubygems] Add a Mutex to prevent a bug on Ruby 3.2:
- There are failing tests on Ruby 3.2 due to an expecation that checks wheter stderr is empty. In this case, stderr outputs a warning from Ruby "warning: loading in progress, circular require considered harmful", but this is not true. This is a bug in Ruby 3.2 that I also encountered in ruby/rubygems#9100 (comment) The problem is that Ruby 3.2 wrongly output this warning when multiple threads try to require a file at the same time. See https://bugs.ruby-lang.org/issues/19415 which was fixed in Ruby 3.2.2. I opted to add a Mutex, as otherwise users on Ruby 3.2 will have this warning output. ruby/rubygems@713dd5c0e1
1 parent ac3b237 commit 174b54c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/bundler/source/rubygems.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class Rubygems < Source
99

1010
# Ask for X gems per API request
1111
API_REQUEST_SIZE = 100
12+
REQUIRE_MUTEX = Mutex.new
1213

1314
attr_accessor :remotes
1415

@@ -521,7 +522,7 @@ def rubygems_gem_installer(spec, options)
521522
path = fetch_gem_if_possible(spec, options[:previous_spec])
522523
raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
523524

524-
require_relative "../rubygems_gem_installer"
525+
REQUIRE_MUTEX.synchronize { require_relative "../rubygems_gem_installer" }
525526

526527
installer = Bundler::RubyGemsGemInstaller.at(
527528
path,

0 commit comments

Comments
 (0)