Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a compatibility issues with statically linked libraries (prism) #464

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 1 addition & 3 deletions lib/bootsnap/load_path_cache/core_ext/kernel_require.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 19 additions & 0 deletions test/load_path_cache/core_ext/kernel_require_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading