summaryrefslogtreecommitdiff
path: root/lib/bundler.rb
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2018-03-01 14:08:32 -0800
committerJohn Hawthorn <john@hawthorn.email>2018-04-20 11:33:30 -0700
commitd8bb345bd82a76fc42f819fbebc001589f53353d (patch)
tree4e6b5c82ad44e25fba62bf89cf00ce2d724d6400 /lib/bundler.rb
parent8cc446c0f6bce6be695ce396f59f918c73255553 (diff)
downloadbundler-d8bb345bd82a76fc42f819fbebc001589f53353d.tar.gz
Check correct paths are writable in requires_sudo?
This method's goal is to check that bundle_path, and directories that bundler may need to write within it are writable. If bundle_path itself does not exist, we instead find the nearest existent parent directory, and check that that exists. However these two rules were combined incorrectly. If bundle_path did not exist, bundler would check that the nearest parent directory _and everything within that parent directory_ were writable. This could lead to false positives for requires_sudo? when bundle_path did not yet exist. This commit fixes the issue by always checking the writability of $bundle_path/* instead of $parent_path/*.
Diffstat (limited to 'lib/bundler.rb')
-rw-r--r--lib/bundler.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 9056c1aa42..9944ebd051 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -365,7 +365,7 @@ EOF
bin_dir = bin_dir.parent until bin_dir.exist?
# if any directory is not writable, we need sudo
- files = [path, bin_dir] | Dir[path.join("build_info/*").to_s] | Dir[path.join("*").to_s]
+ files = [path, bin_dir] | Dir[bundle_path.join("build_info/*").to_s] | Dir[bundle_path.join("*").to_s]
sudo_needed = files.any? {|f| !File.writable?(f) }
end