From 0ca61d55aef3308bf4f8e0eeb0cda7aa259e6fe5 Mon Sep 17 00:00:00 2001 From: nvg Date: Fri, 2 Nov 2018 15:03:54 -0700 Subject: [PATCH] Check if umask is 000 in brew doctor --- Library/Homebrew/extend/os/linux/diagnostic.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Library/Homebrew/extend/os/linux/diagnostic.rb b/Library/Homebrew/extend/os/linux/diagnostic.rb index 12c5e0a162..63db648831 100644 --- a/Library/Homebrew/extend/os/linux/diagnostic.rb +++ b/Library/Homebrew/extend/os/linux/diagnostic.rb @@ -48,6 +48,17 @@ module Homebrew #{Utils::Shell.prepend_variable_in_profile("XDG_DATA_DIRS", HOMEBREW_PREFIX/"share")} EOS end + + def check_umask_not_zero + return unless File.umask.zero? + + <<~EOS + umask is currently set to 000. Directories created by Homebrew cannot + be world-writable. This issue can be resolved by adding umask 002 to + your #{shell_profile} + echo 'umask 002' >> #{shell_profile} + EOS + end end end end