diff options
author | Adam Wanninger <ajwann@ajwann.codes> | 2018-01-14 10:38:57 -0500 |
---|---|---|
committer | Adam Wanninger <ajwann@ajwann.codes> | 2018-01-25 10:01:13 -0500 |
commit | 2a21e5e3ac377e87a81b7ddd910d7a85bf256dd6 (patch) | |
tree | fc3af485158ed9c39ad8adacd440b9c6909ae41c /lib | |
parent | b1fd32c2f34512525253a5da2882e3e4612967b1 (diff) | |
download | bundler-2a21e5e3ac377e87a81b7ddd910d7a85bf256dd6.tar.gz |
warn user if a file is not R/W and owned by another user
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/cli/doctor.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/bundler/cli/doctor.rb b/lib/bundler/cli/doctor.rb index 6fd9f177bb..3e0898ff8a 100644 --- a/lib/bundler/cli/doctor.rb +++ b/lib/bundler/cli/doctor.rb @@ -98,10 +98,15 @@ module Bundler def check_home_permissions require "find" files_not_readable_or_writable = [] + files_not_rw_and_owned_by_different_user = [] files_not_owned_by_current_user_but_still_rw = [] Find.find(Bundler.home.to_s).each do |f| if !File.writable?(f) || !File.readable?(f) - files_not_readable_or_writable << f + if File.stat(f).uid != Process.uid + files_not_rw_and_owned_by_different_user << f + else + files_not_readable_or_writable << f + end elsif File.stat(f).uid != Process.uid files_not_owned_by_current_user_but_still_rw << f end @@ -115,6 +120,13 @@ module Bundler ok = false end + if files_not_rw_and_owned_by_different_user.any? + Bundler.ui.warn "Files exist in the Bundler home that are owned by another " \ + "user, and are not readable/writable. These files are:\n - #{files_not_rw_and_owned_by_different_user.join("\n - ")}" + + ok = false + end + if files_not_readable_or_writable.any? Bundler.ui.warn "Files exist in the Bundler home that are not " \ "readable/writable by the current user. These files are:\n - #{files_not_readable_or_writable.join("\n - ")}" |