1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[bundler/bundler] Don't use system bundler on this spec

If we use system bundler, when booting the "outermost" bundler process,
bundler will save the path to the system bundler in BUNDLE_BIN_PATH, and
use it again when booting the "innermost" bundler process (`bundle exec
echo foo`).

That means that second process will use the system bundler path again.
However, we have `-rsupport/hax` in RUBYOPT, so that file will load from
the local copy of bundler, and that file will load `bundler/version`
from the project (not from system), because -Ilib is in the LOAD_PATH.

That will end up causing redefinition errors because the same constant
will be loaded from two different locations.

In general, this is expected behavior, normally you will wrap the
process with `Bundler.with_original_env` to reset the environment.
However, the easiest fix here is to not use system bundler, because it's
not really necessary and thus doesn't help the readability of the spec.

https://github.com/bundler/bundler/commit/a3d72a34ab
This commit is contained in:
David Rodríguez 2019-08-16 17:54:12 +02:00 committed by Hiroshi SHIBATA
parent 0653d8c601
commit 5a69a23afc

View file

@ -837,14 +837,12 @@ __FILE__: #{path.to_s.inspect}
context "nested bundle exec" do
context "when bundle in a local path" do
before do
system_gems :bundler
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
bundle "config set path vendor/bundler"
bundle! :install, :system_bundler => true
bundle! :install
end
it "correctly shells out", :ruby_repo do
@ -854,7 +852,7 @@ __FILE__: #{path.to_s.inspect}
puts `bundle exec echo foo`
RB
file.chmod(0o777)
bundle! "exec #{file}", :system_bundler => true
bundle! "exec #{file}"
expect(out).to eq("foo")
end
end