summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2018-01-04 22:21:25 +0000
committerThe Bundler Bot <bot@bundler.io>2018-01-04 22:21:25 +0000
commitfa7e4640c06d6c7d9e7c99480342f34008aa05fd (patch)
treea9e34ee8ca48b97b13a43193621f89fd251bf960
parentab14bb1938d70cbe76a1fe1ddba64a84cee5a847 (diff)
parentfbb1ff7a6fae5e63614f74622156d583ac312629 (diff)
downloadbundler-fa7e4640c06d6c7d9e7c99480342f34008aa05fd.tar.gz
Auto merge of #6237 - MSP-Greg:fix_src_loc_warning, r=segiddins
Fix warning in rubygems testing re __FILE__ Thanks so much for the contribution! To make reviewing this PR a bit easier, please fill out answers to the following questions. ### What was the end-user problem that led to this PR? Testing with trunk & rubygems, many warnings of: `rubygems/lib/rubygems.rb:940: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead` ### What was your diagnosis of the problem? Updates for warnings & 'security' in trunk are showing issues that should be addressed. ### What is your fix for the problem, implemented in this PR? It's one line... ### Why did you choose this fix out of the possible options? Unaware of other options... Not sure if this will work with all ruby versions. Did not test my fork...
-rw-r--r--lib/bundler/rubygems_integration.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 0f16b6231d..2d70eae7dc 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -570,8 +570,10 @@ module Bundler
@replaced_methods.each do |(sym, klass), method|
redefine_method(klass, sym, method)
end
- post_reset_hooks.reject! do |proc|
- proc.binding.eval("__FILE__") == __FILE__
+ if Binding.public_method_defined?(:source_location)
+ post_reset_hooks.reject! {|proc| proc.binding.source_location == __FILE__ }
+ else
+ post_reset_hooks.reject! {|proc| proc.binding.eval("__FILE__") == __FILE__ }
end
@replaced_methods.clear
end