Skip to content

Lazily define FFI-using File methods#6760

Merged
headius merged 1 commit intojruby:masterfrom
headius:lazy_file_ffi
Jul 23, 2021
Merged

Lazily define FFI-using File methods#6760
headius merged 1 commit intojruby:masterfrom
headius:lazy_file_ffi

Conversation

@headius
Copy link
Member

@headius headius commented Jul 23, 2021

Activating FFI this early prevents it being upgraded by RubyGems
or Bundler. This also happens so early that there's no way to
eagerly activate the gem to pick up a newer version. As a result,
bundles or gems that depend on newer FFI will error or warn about
the mismatch.

This change modifies the FFI-based File methods on Windows
(File.symlink) and Solaris (File#flock) to lazily require a
separate file that loads FFI and redefines those methods.

Fixes #6751

Activating FFI this early prevents it being upgraded by RubyGems
or Bundler. This also happens so early that there's no way to
eagerly activate the gem to pick up a newer version. As a result,
bundles or gems that depend on newer FFI will error or warn about
the mismatch.

This change modifies the FFI-based File methods on Windows
(File.symlink) and Solaris (File#flock) to lazily require a
separate file that loads FFI and redefines those methods.

Fixes jruby#6751
@headius headius added this to the JRuby 9.3.0.0 milestone Jul 23, 2021
@headius headius merged commit 68f7711 into jruby:master Jul 23, 2021
@headius headius deleted the lazy_file_ffi branch July 23, 2021 21:26
headius added a commit to headius/jruby that referenced this pull request Aug 16, 2021
See jruby#6760 and related commits to these files on master.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9.3 : Gem::LoadError: You have already activated ffi 1.15.1, but your Gemfile requires ffi 1.15.3.

1 participant