From 9edf8eb1fe95ed72b624edd4d2127bbc780e7bce Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 11 Nov 2016 22:52:21 +0000 Subject: Check the lock directory is writable. And, if it isn't, print more helpful debugging messages. Fixes #1456. --- Library/Homebrew/utils/lock.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew/utils') diff --git a/Library/Homebrew/utils/lock.sh b/Library/Homebrew/utils/lock.sh index cc041fa74..7f0638c1a 100644 --- a/Library/Homebrew/utils/lock.sh +++ b/Library/Homebrew/utils/lock.sh @@ -6,6 +6,14 @@ lock() { local lock_dir="$HOMEBREW_PREFIX/var/homebrew/locks" local lock_file="$lock_dir/$name" [[ -d "$lock_dir" ]] || mkdir -p "$lock_dir" + if ! [[ -w "$lock_dir" ]] + then + odie <&- # open the lock file to FD, so the shell process can hold the lock. exec 200>"$lock_file" - if ! _create_lock 200 + if ! _create_lock 200 "$name" then odie <