From 05ae2c11fa0464b258d40ff330839a303fbdfd67 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Thu, 6 Jun 2019 15:54:17 +0200 Subject: [PATCH] [rubygems/rubygems] Do not replace the cache entry if there is already one * That way, multiple lookups for the same file always return the same object. https://github.com/rubygems/rubygems/commit/50a431b6db --- lib/rubygems/specification.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index abb6e0ecfd..3c8248793c 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -1124,7 +1124,12 @@ class Gem::Specification < Gem::BasicSpecification if Gem::Specification === _spec _spec.loaded_from = File.expand_path file.to_s LOAD_CACHE_MUTEX.synchronize do - LOAD_CACHE[file] = _spec + prev = LOAD_CACHE[file] + if prev + _spec = prev + else + LOAD_CACHE[file] = _spec + end end return _spec end