From 72202aab5e5b3602ece4e8748bcdeefe2d789ab5 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Fri, 13 Jan 2023 09:21:17 +0100 Subject: [PATCH] Use `RbConfig::CONFIG["rubylibdir"]` to check for stdlib files Ref: https://github.com/Shopify/bootsnap/issues/431 --- CHANGELOG.md | 2 ++ lib/bootsnap/load_path_cache/path.rb | 4 ++-- test/load_path_cache/path_test.rb | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1aadf9e..f38db3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased +* Use `RbConfig::CONFIG["rubylibdir"]` instead of `RbConfig::CONFIG["libdir"]` to check for stdlib files. See #431. + # 1.15.0 * Add a readonly mode, for environments in which the updated cache wouldn't be persisted. See #428 and #423. diff --git a/lib/bootsnap/load_path_cache/path.rb b/lib/bootsnap/load_path_cache/path.rb index 626740c..e000c60 100644 --- a/lib/bootsnap/load_path_cache/path.rb +++ b/lib/bootsnap/load_path_cache/path.rb @@ -116,8 +116,8 @@ def latest_mtime(path, dirs) VOLATILE = :volatile # Built-in ruby lib stuff doesn't change, but things can occasionally be - # installed into sitedir, which generally lives under libdir. - RUBY_LIBDIR = RbConfig::CONFIG["libdir"] + # installed into sitedir, which generally lives under rubylibdir. + RUBY_LIBDIR = RbConfig::CONFIG["rubylibdir"] RUBY_SITEDIR = RbConfig::CONFIG["sitedir"] def stability diff --git a/test/load_path_cache/path_test.rb b/test/load_path_cache/path_test.rb index 5425ed9..2c1c289 100644 --- a/test/load_path_cache/path_test.rb +++ b/test/load_path_cache/path_test.rb @@ -16,7 +16,7 @@ def test_stability volatile = Path.new(__FILE__) stable = Path.new(time_file) unknown = Path.new("/who/knows") - lib = Path.new("#{RbConfig::CONFIG['libdir']}/a") + lib = Path.new("#{RbConfig::CONFIG['rubylibdir']}/a") site = Path.new("#{RbConfig::CONFIG['sitedir']}/b") absolute_prefix = RbConfig::CONFIG["host_os"] =~ /mswin|mingw|cygwin/ ? ENV["SystemDrive"] : "" bundler = Path.new("#{absolute_prefix}/bp/3")