summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-02-05 01:39:04 +0000
committerBundlerbot <bot@bundler.io>2019-02-05 01:39:04 +0000
commit9cbc7dd8f77bcc12fd7e4265ebbd948f0e19b7f7 (patch)
treeafbaffdb1af62f4ae7bad0fc0edba43fd54b0350
parent66e4215dbf87fedf2fdff3532a0742340c4e02f2 (diff)
parent5adc2402cf024222670f4292f909fbe5aa8dc17f (diff)
downloadbundler-9cbc7dd8f77bcc12fd7e4265ebbd948f0e19b7f7.tar.gz
Merge #6941
6941: Ignore to add bundler lib direcotry if it is same as rubylibdir r=hsbt a=hsbt ### What was the end-user problem that led to this PR? In ruby core, the bundled bundler was located same as rubylibdir. When user used the specific version of default gems like json, Bundler uses default gems under the rubylibdir, not a specific version. Fixed https://bugs.ruby-lang.org/issues/15469 ### What was your diagnosis of the problem? See the details: https://bugs.ruby-lang.org/issues/15469#note-4 ### What is your fix for the problem, implemented in this PR? I avoid adding bundler directory from RUBYLIB environmental variable Because its directory was already added $LOAD_PATH. Co-authored-by: SHIBATA Hiroshi <hsbt@ruby-lang.org>
-rw-r--r--lib/bundler/shared_helpers.rb3
-rw-r--r--spec/bundler/shared_helpers_spec.rb9
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index e09e5e8b74..6a0da52e1e 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -3,6 +3,7 @@
require "bundler/compatibility_guard"
require "pathname"
+require "rbconfig"
require "rubygems"
require "bundler/version"
@@ -341,7 +342,7 @@ module Bundler
def set_rubylib
rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR)
- rubylib.unshift bundler_ruby_lib
+ rubylib.unshift bundler_ruby_lib unless RbConfig::CONFIG["rubylibdir"] == bundler_ruby_lib
Bundler::SharedHelpers.set_env "RUBYLIB", rubylib.uniq.join(File::PATH_SEPARATOR)
end
diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb
index b66c43fd92..fcac37b398 100644
--- a/spec/bundler/shared_helpers_spec.rb
+++ b/spec/bundler/shared_helpers_spec.rb
@@ -261,6 +261,15 @@ RSpec.describe Bundler::SharedHelpers do
subject.set_bundle_environment
end
+ it "ignores if bundler_ruby_lib is same as rubylibdir" do
+ allow(Bundler::SharedHelpers).to receive(:bundler_ruby_lib).and_return(RbConfig::CONFIG["rubylibdir"])
+
+ subject.set_bundle_environment
+
+ paths = (ENV["RUBYLIB"]).split(File::PATH_SEPARATOR)
+ expect(paths.count(RbConfig::CONFIG["rubylibdir"])).to eq(0)
+ end
+
it "exits if bundle path contains the unix-like path separator" do
if Gem.respond_to?(:path_separator)
allow(Gem).to receive(:path_separator).and_return(":")