diff options
author | The Bundler Bot <bot@bundler.io> | 2017-01-21 18:41:03 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2017-01-21 18:41:03 +0000 |
commit | e60c73554ddc6d5bd58b1967c0c4c4acf3a5c253 (patch) | |
tree | 78be80f8cbed722459f226e660dc07cc35814578 | |
parent | 990f05e86593c0a821c538ae9cae535c298eee7a (diff) | |
parent | 9d8fd46a6ea466a6438ffa7fef87e922ffdcd499 (diff) | |
download | bundler-e60c73554ddc6d5bd58b1967c0c4c4acf3a5c253.tar.gz |
Auto merge of #5342 - bundler:seg-ruby-2-2-2-bug, r=segiddins
[SharedHelpers] Use block.call instead of yield to avoid a stack cons…
…istency error on Ruby 2.2.2
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
Fixes https://github.com/bundler/bundler/issues/5341
Manually tested on Ruby 2.2.2 and 2.2.3, since they're not in the test matrix (only the latest 2.2.x is)
-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 613609f2..44b9136c 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 |