diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2018-05-23 05:51:53 +0200 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2018-06-12 10:28:18 +0100 |
commit | fb40210e0642547e6b7802f934a42cb207eba165 (patch) | |
tree | 5c956e5e9b2f19783d763b5e900f27d1643bb34f /lib/bundler.rb | |
parent | c793c38a55559677573d28d4bfadd811e8508b48 (diff) | |
download | bundler-fb40210e0642547e6b7802f934a42cb207eba165.tar.gz |
Don't fallback to tempdir when required directories exist.
When home directory is not writable, but the required .bundle is,
we should use it instead of falling back to use tempdirs.
This creates a workaround for more restrictive setups using Omnibus
Docker or any hardened setup, to overcome the annoyances introduced by #4951.
Diffstat (limited to 'lib/bundler.rb')
-rw-r--r-- | lib/bundler.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index 9944ebd051..8ed5b0861f 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -159,12 +159,13 @@ module Bundler def user_home @user_home ||= begin home = Bundler.rubygems.user_home + bundle_home = home ? File.join(home, ".bundle") : nil warning = if home.nil? "Your home directory is not set." elsif !File.directory?(home) "`#{home}` is not a directory." - elsif !File.writable?(home) + elsif !File.writable?(home) && (!File.directory?(bundle_home) || !File.writable?(bundle_home)) "`#{home}` is not writable." end |