summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-08-26 01:49:24 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-08-26 02:47:04 +0900
commit7d32011399cbc3aa7e4b728a440e13635a39f2ed (patch)
treef78bfe8920ee78102a58dc5e5060d2c4d2ce0e17 /lib
parent40efbc7e406699a7a5c56802233d6748bf30805b (diff)
[Bug #19852] Use gem name without suffix
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/8295
Diffstat (limited to 'lib')
-rw-r--r--lib/bundled_gems.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/bundled_gems.rb b/lib/bundled_gems.rb
index 7dbb761dbf..cebf72798f 100644
--- a/lib/bundled_gems.rb
+++ b/lib/bundled_gems.rb
@@ -51,7 +51,9 @@ module Gem::BUNDLED_GEMS
conf = ::RbConfig::CONFIG
LIBDIR = (conf["rubylibdir"] + "/").freeze
ARCHDIR = (conf["rubyarchdir"] + "/").freeze
- DLEXT = /\.#{Regexp.union([conf["DLEXT"], "so"].uniq)}\z/
+ dlext = [conf["DLEXT"], "so"].uniq
+ DLEXT = /\.#{Regexp.union(dlext)}\z/
+ LIBEXT = /\.#{Regexp.union("rb", *dlext)}\z/
def self.find_gem(path)
if !path
@@ -69,12 +71,12 @@ module Gem::BUNDLED_GEMS
def self.warning?(name)
_t, path = $:.resolve_feature_path(name)
return unless gem = find_gem(path)
- caller, = caller_locations(3, 1)
+ caller = caller_locations(3, 3).find {|c| c&.absolute_path}
return if find_gem(caller&.absolute_path)
return if WARNED[name]
WARNED[name] = true
if gem == true
- gem = name
+ gem = name.sub(LIBEXT, "") # assume "foo.rb"/"foo.so" belongs to "foo" gem
elsif gem
return if WARNED[gem]
WARNED[gem] = true