diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 981ac4b..e8d66b9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -34,7 +34,7 @@ jobs: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 with: - ruby-version: '2.6' + ruby-version: '3.3' bundler-cache: true - run: bundle exec rubocop @@ -43,7 +43,7 @@ jobs: fail-fast: false matrix: os: [ubuntu] - ruby: ['2.6', '2.7', '3.0', '3.1', '3.2', 'ruby-head', 'debug', 'truffleruby', 'truffleruby-head'] + ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', 'ruby-head', 'debug', 'truffleruby', 'truffleruby-head'] runs-on: ${{ matrix.os }}-latest steps: - uses: actions/checkout@v2 @@ -58,7 +58,7 @@ jobs: fail-fast: false matrix: os: [ubuntu] - ruby: ['3.0'] + ruby: ['3.3'] runs-on: ${{ matrix.os }}-latest env: PSYCH_4: "1" diff --git a/CHANGELOG.md b/CHANGELOG.md index 6166163..c7e02d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Unreleased +* Fix a compatibility issue with the `prism` library that ships with Ruby 3.3. See #463. * Improved the `Kernel#require` decorator to not cause a method redefinition warning. See #461. # 1.17.0 diff --git a/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb b/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb index 33540ba..ba4d764 100644 --- a/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb +++ b/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb @@ -24,9 +24,7 @@ def require(path) # rubocop:disable Lint/DuplicateMethods elsif false == resolved return false elsif resolved.nil? - error = LoadError.new(+"cannot load such file -- #{path}") - error.instance_variable_set(:@path, path) - raise error + return require_without_bootsnap(path) else # Note that require registers to $LOADED_FEATURES while load does not. ret = require_without_bootsnap(resolved) diff --git a/test/load_path_cache/core_ext/kernel_require_test.rb b/test/load_path_cache/core_ext/kernel_require_test.rb index b1a7a93..dc120ea 100644 --- a/test/load_path_cache/core_ext/kernel_require_test.rb +++ b/test/load_path_cache/core_ext/kernel_require_test.rb @@ -31,6 +31,25 @@ def test_uses_the_same_duck_type_as_require cache.unlink end end + + def test_load_static_libaries + skip("Need a working Process.fork to test in isolation") unless Process.respond_to?(:fork) + skip("Need some libraries to be compiled statically") unless RUBY_VERSION >= "3.3" + + begin + assert_nil LoadPathCache.load_path_cache + cache = Tempfile.new("cache") + pid = Process.fork do + LoadPathCache.setup(cache_path: cache, development_mode: false, ignore_directories: nil) + require("prism") + end + _, status = Process.wait2(pid) + assert_predicate status, :success? + ensure + cache.close + cache.unlink + end + end end class KernelLoadTest < Minitest::Test