From 5a0cbc934428b3babdce6f5d014c30afcb84e567 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 13 Dec 2023 16:38:15 +0900 Subject: [PATCH] Detect bootsnap from all frames --- lib/bundled_gems.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/bundled_gems.rb b/lib/bundled_gems.rb index 0cd3805bd9..3d7243e7a3 100644 --- a/lib/bundled_gems.rb +++ b/lib/bundled_gems.rb @@ -102,8 +102,12 @@ module Gem::BUNDLED_GEMS else return end - # Warning feature is not working correctly with Bootsnap - return if caller_locations(2,1)[0]&.path.match?(/bootsnap/) + # Warning feature is not working correctly with Bootsnap. + # caller_locations returns: + # lib/ruby/3.3.0+0/bundled_gems.rb:65:in `block (2 levels) in replace_require' + # $GEM_HOME/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'" + # ... + return if caller_locations(2).find {|c| c&.path.match?(/bootsnap/) } return if WARNED[name] WARNED[name] = true if gem == true