summaryrefslogtreecommitdiff
path: root/lib/bundler
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-08-18 00:44:06 +0000
committerBundlerbot <bot@bundler.io>2019-08-18 00:44:06 +0000
commit6125cb3d81908a3505dad8acbe94861176a13b22 (patch)
tree7e8973570c7a6182b1691d8c1d4f9149b93dbd27 /lib/bundler
parent64271ffdc2fb06c46d170991151f92687c4857a6 (diff)
parent8ef571ed4e443e066cc17c01de753953ff205c04 (diff)
downloadbundler-6125cb3d81908a3505dad8acbe94861176a13b22.tar.gz
Merge #7274
7274: Fix more leaks to default copy of bundler r=hsbt a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that in some places, it was still possible to end up requiring files in a different copy of bundler (the default copy). I noticed this when I removed a rubygems monkeypatch from the test suite that was preventing the default copy of bundler from being activated when requiring files. This thing: https://github.com/bundler/bundler/blob/e1c518363641208429f397170354054b3d28effd/spec/support/hax.rb#L15-L20 ### What was your diagnosis of the problem? My diagnosis was that I should use relative requires wherever they were missing. ### What is your fix for the problem, implemented in this PR? My fix is to remove the rubygems hack, migrate the rest of the internal requires to be relative, and also introduce some hacks on our specs to make sure we never load the incorrect copy of bundler. I think this PR should fix the issues in https://github.com/rubygems/rubygems/pull/2863. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
Diffstat (limited to 'lib/bundler')
-rw-r--r--lib/bundler/plugin.rb10
-rw-r--r--lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb6
-rw-r--r--lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb2
-rw-r--r--lib/bundler/vendored_fileutils.rb7
4 files changed, 10 insertions, 15 deletions
diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb
index ffb3ee9883..f4dd435df4 100644
--- a/lib/bundler/plugin.rb
+++ b/lib/bundler/plugin.rb
@@ -4,11 +4,11 @@ require_relative "plugin/api"
module Bundler
module Plugin
- autoload :DSL, "bundler/plugin/dsl"
- autoload :Events, "bundler/plugin/events"
- autoload :Index, "bundler/plugin/index"
- autoload :Installer, "bundler/plugin/installer"
- autoload :SourceList, "bundler/plugin/source_list"
+ autoload :DSL, File.expand_path("plugin/dsl", __dir__)
+ autoload :Events, File.expand_path("plugin/events", __dir__)
+ autoload :Index, File.expand_path("plugin/index", __dir__)
+ autoload :Installer, File.expand_path("plugin/installer", __dir__)
+ autoload :SourceList, File.expand_path("plugin/source_list", __dir__)
class MalformattedPlugin < PluginError; end
class UndefinedCommandError < PluginError; end
diff --git a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
index f3382465a7..327cb0f8c2 100644
--- a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
+++ b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
@@ -1,7 +1,7 @@
require 'net/http'
require 'uri'
require 'cgi' # for escaping
-require 'bundler/vendor/connection_pool/lib/connection_pool'
+require_relative '../../../../connection_pool/lib/connection_pool'
begin
require 'net/http/pipeline'
@@ -1197,6 +1197,6 @@ application:
end
-require 'bundler/vendor/net-http-persistent/lib/net/http/persistent/connection'
-require 'bundler/vendor/net-http-persistent/lib/net/http/persistent/pool'
+require_relative 'persistent/connection'
+require_relative 'persistent/pool'
diff --git a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb
index fb1816de83..9dfa6ffdb1 100644
--- a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb
+++ b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb
@@ -49,5 +49,5 @@ class Bundler::Persistent::Net::HTTP::Persistent::Pool < Bundler::ConnectionPool
end
end
-require 'bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi'
+require_relative 'timed_stack_multi'
diff --git a/lib/bundler/vendored_fileutils.rb b/lib/bundler/vendored_fileutils.rb
index 4b71759224..1be1138ce2 100644
--- a/lib/bundler/vendored_fileutils.rb
+++ b/lib/bundler/vendored_fileutils.rb
@@ -1,9 +1,4 @@
# frozen_string_literal: true
module Bundler; end
-if RUBY_VERSION >= "2.4"
- require_relative "vendor/fileutils/lib/fileutils"
-else
- # the version we vendor is 2.4+
- require "fileutils"
-end
+require_relative "vendor/fileutils/lib/fileutils"