diff options
author | The Bundler Bot <bot@bundler.io> | 2018-01-04 22:21:25 +0000 |
---|---|---|
committer | Colby Swandale <me@colby.fyi> | 2018-04-20 10:25:39 +1000 |
commit | d053760011777c05ee018f8a8f6c2812c1a7c7aa (patch) | |
tree | 01612ab7f502d6e36ff8c9b018caa4b51680fd15 | |
parent | 72061539d4b147d7b641892435c778d5b6458ad5 (diff) | |
download | bundler-d053760011777c05ee018f8a8f6c2812c1a7c7aa.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...
(cherry picked from commit fa7e4640c06d6c7d9e7c99480342f34008aa05fd)
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 6 |
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 |