summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-01-21 18:41:03 +0000
committerSamuel Giddins <segiddins@segiddins.me>2017-01-21 14:50:00 -0600
commit3494d01e2464b12ce47b40a8d83920ee02dc26ec (patch)
tree55a31678ed45cbe132752318c1aeb79d8bcf4d5f
parentfb5deeffc916763b47f6bd332474668bae062d7c (diff)
downloadbundler-3494d01e2464b12ce47b40a8d83920ee02dc26ec.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) (cherry picked from commit e60c73554ddc6d5bd58b1967c0c4c4acf3a5c253)
-rw-r--r--lib/bundler/shared_helpers.rb6
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