diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-01-21 10:21:47 -0600 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-01-21 10:21:47 -0600 |
commit | 9d8fd46a6ea466a6438ffa7fef87e922ffdcd499 (patch) | |
tree | 78be80f8cbed722459f226e660dc07cc35814578 | |
parent | 990f05e86593c0a821c538ae9cae535c298eee7a (diff) | |
download | bundler-seg-ruby-2-2-2-bug.tar.gz |
[SharedHelpers] Use block.call instead of yield to avoid a stack consistency error on Ruby 2.2.2seg-ruby-2-2-2-bug
Using `yield` would cause a crash in the ruby VM due to calls sharing state
and leading to a count mismatch. Using block.call avoids that issue
-rw-r--r-- | lib/bundler/shared_helpers.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 613609f25f..44b9136c0b 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -102,8 +102,10 @@ module Bundler # end # # @see {Bundler::PermissionError} - def filesystem_access(path, action = :write) - yield path.dup.untaint + def filesystem_access(path, action = :write, &block) + # Use block.call instead of yield because of a bug in Ruby 2.2.2 + # See https://github.com/bundler/bundler/issues/5341 for details + block.call(path.dup.untaint) rescue Errno::EACCES raise PermissionError.new(path, action) rescue Errno::EAGAIN |