From 4adbfa3fcfc7f6ce3d51414ab1e42cf5acbc41b0 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Tue, 14 Aug 2018 11:51:18 -0700 Subject: [PATCH] Check that HOMEBREW_TEMP permits executing programs --- Library/Homebrew/extend/os/linux/diagnostic.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Library/Homebrew/extend/os/linux/diagnostic.rb b/Library/Homebrew/extend/os/linux/diagnostic.rb index 63f8d7b479..ea3e1ab8ad 100644 --- a/Library/Homebrew/extend/os/linux/diagnostic.rb +++ b/Library/Homebrew/extend/os/linux/diagnostic.rb @@ -17,6 +17,23 @@ module Homebrew EOS end + def check_tmpdir_executable + f = Tempfile.new(%w[homebrew_check_tmpdir_executable .sh], HOMEBREW_TEMP) + f.write "#!/bin/sh\n" + f.chmod 0700 + f.close + return if system f.path + <<~EOS.undent + The directory #{HOMEBREW_TEMP} does not permit executing + programs. It is likely mounted as "noexec". Please set HOMEBREW_TEMP + in your #{shell_profile} to a different directory, for example: + export HOMEBREW_TEMP=~/tmp + echo 'export HOMEBREW_TEMP=~/tmp' >> #{shell_profile} + EOS + ensure + f.unlink + end + def check_xdg_data_dirs return if ENV["XDG_DATA_DIRS"].to_s.empty? return if ENV["XDG_DATA_DIRS"].split("/").include?(HOMEBREW_PREFIX/"share")