aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-06-06 15:54:17 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-07-31 07:47:00 +0800
commit05ae2c11fa0464b258d40ff330839a303fbdfd67 (patch)
tree6a7004bd4ce72c475b25cafdcbdc1deea9cd309d
parent2453d16f5e44f67a50e1be9b08504a14960610ef (diff)
downloadruby-05ae2c11fa0464b258d40ff330839a303fbdfd67.tar.gz
[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
-rw-r--r--lib/rubygems/specification.rb7
1 files changed, 6 insertions, 1 deletions
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