diff options
| author | Eugene Kenny <elkenny@gmail.com> | 2024-04-24 12:10:48 +0100 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-04-25 13:29:28 +0900 |
| commit | 67dd9af17e5c6c541a8cc84b1741deaf175fcf83 (patch) | |
| tree | d99f373e1f595f3d9a92872bc33bb83ebcfdaa23 | |
| parent | 01f6ea15838c2ed81fccac908033a30a27073036 (diff) | |
[Bug #20450] Remove rubyarchdir from bootsnap paths
| -rw-r--r-- | lib/bundled_gems.rb | 7 | ||||
| -rwxr-xr-x | tool/test_for_warn_bundled_gems/test.sh | 4 | ||||
| -rw-r--r-- | tool/test_for_warn_bundled_gems/test_warn_bootsnap_rubyarchdir_gem.rb | 11 |
3 files changed, 20 insertions, 2 deletions
diff --git a/lib/bundled_gems.rb b/lib/bundled_gems.rb index a340463c98..ed5f940b57 100644 --- a/lib/bundled_gems.rb +++ b/lib/bundled_gems.rb @@ -101,8 +101,11 @@ module Gem::BUNDLED_GEMS def self.warning?(name, specs: nil) # name can be a feature name or a file path with String or Pathname feature = File.path(name) - # bootsnap expand `require "csv"` to `require "#{LIBDIR}/csv.rb"` - name = feature.delete_prefix(LIBDIR).chomp(".rb").tr("/", "-") + # bootsnap expands `require "csv"` to `require "#{LIBDIR}/csv.rb"`, + # and `require "syslog"` to `require "#{ARCHDIR}/syslog.so"`. + name = feature.delete_prefix(ARCHDIR) + name.delete_prefix!(LIBDIR) + name.tr!("/", "-") name.sub!(LIBEXT, "") return if specs.include?(name) _t, path = $:.resolve_feature_path(feature) diff --git a/tool/test_for_warn_bundled_gems/test.sh b/tool/test_for_warn_bundled_gems/test.sh index 2404571daf..a14d5bcedc 100755 --- a/tool/test_for_warn_bundled_gems/test.sh +++ b/tool/test_for_warn_bundled_gems/test.sh @@ -32,6 +32,10 @@ echo "* Show warning with bootsnap" ruby test_warn_bootsnap.rb echo +echo "* Show warning with bootsnap for gem with native extension" +ruby test_warn_bootsnap_rubyarchdir_gem.rb +echo + echo "* Show warning with zeitwerk" ruby test_warn_zeitwerk.rb echo diff --git a/tool/test_for_warn_bundled_gems/test_warn_bootsnap_rubyarchdir_gem.rb b/tool/test_for_warn_bundled_gems/test_warn_bootsnap_rubyarchdir_gem.rb new file mode 100644 index 0000000000..477933f6f2 --- /dev/null +++ b/tool/test_for_warn_bundled_gems/test_warn_bootsnap_rubyarchdir_gem.rb @@ -0,0 +1,11 @@ +require "bundler/inline" + +gemfile do + source "https://rubygems.org" + gem "bootsnap", require: false +end + +require 'bootsnap' +Bootsnap.setup(cache_dir: 'tmp/cache') + +require 'syslog' |
