Skip to content

Commit e0542c0

Browse files
authored
Merge pull request #464 from Shopify/handle-prism
Fix a compatibility issues with statically linked libraries (prism)
2 parents 070151f + a53bad1 commit e0542c0

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- uses: actions/checkout@v2
3535
- uses: ruby/setup-ruby@v1
3636
with:
37-
ruby-version: '2.6'
37+
ruby-version: '3.3'
3838
bundler-cache: true
3939
- run: bundle exec rubocop
4040

@@ -43,7 +43,7 @@ jobs:
4343
fail-fast: false
4444
matrix:
4545
os: [ubuntu]
46-
ruby: ['2.6', '2.7', '3.0', '3.1', '3.2', 'ruby-head', 'debug', 'truffleruby', 'truffleruby-head']
46+
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', 'ruby-head', 'debug', 'truffleruby', 'truffleruby-head']
4747
runs-on: ${{ matrix.os }}-latest
4848
steps:
4949
- uses: actions/checkout@v2
@@ -58,7 +58,7 @@ jobs:
5858
fail-fast: false
5959
matrix:
6060
os: [ubuntu]
61-
ruby: ['3.0']
61+
ruby: ['3.3']
6262
runs-on: ${{ matrix.os }}-latest
6363
env:
6464
PSYCH_4: "1"

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Unreleased
22

3+
* Fix a compatibility issue with the `prism` library that ships with Ruby 3.3. See #463.
34
* Improved the `Kernel#require` decorator to not cause a method redefinition warning. See #461.
45

56
# 1.17.0

lib/bootsnap/load_path_cache/core_ext/kernel_require.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ def require(path) # rubocop:disable Lint/DuplicateMethods
2424
elsif false == resolved
2525
return false
2626
elsif resolved.nil?
27-
error = LoadError.new(+"cannot load such file -- #{path}")
28-
error.instance_variable_set(:@path, path)
29-
raise error
27+
return require_without_bootsnap(path)
3028
else
3129
# Note that require registers to $LOADED_FEATURES while load does not.
3230
ret = require_without_bootsnap(resolved)

test/load_path_cache/core_ext/kernel_require_test.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,25 @@ def test_uses_the_same_duck_type_as_require
3131
cache.unlink
3232
end
3333
end
34+
35+
def test_load_static_libaries
36+
skip("Need a working Process.fork to test in isolation") unless Process.respond_to?(:fork)
37+
skip("Need some libraries to be compiled statically") unless RUBY_VERSION >= "3.3"
38+
39+
begin
40+
assert_nil LoadPathCache.load_path_cache
41+
cache = Tempfile.new("cache")
42+
pid = Process.fork do
43+
LoadPathCache.setup(cache_path: cache, development_mode: false, ignore_directories: nil)
44+
require("prism")
45+
end
46+
_, status = Process.wait2(pid)
47+
assert_predicate status, :success?
48+
ensure
49+
cache.close
50+
cache.unlink
51+
end
52+
end
3453
end
3554

3655
class KernelLoadTest < Minitest::Test

0 commit comments

Comments
 (0)