From 271023c5e11ec5fc8be39a2161c43b2ffd034ce6 Mon Sep 17 00:00:00 2001 From: Martin Afanasjew Date: Wed, 29 Jun 2016 14:05:40 +0200 Subject: [PATCH] analytics: handle UUID generation errors Avoid writing an empty UUID to the Git configuration file and disable analytics temporarily to avoid sending bogus data with an invalid UUID. --- Library/Homebrew/utils/analytics.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Library/Homebrew/utils/analytics.sh b/Library/Homebrew/utils/analytics.sh index 37148dd43f..f0ec2c46e2 100644 --- a/Library/Homebrew/utils/analytics.sh +++ b/Library/Homebrew/utils/analytics.sh @@ -36,6 +36,13 @@ setup-analytics() { if [[ -z "$HOMEBREW_ANALYTICS_USER_UUID" ]] then HOMEBREW_ANALYTICS_USER_UUID="$(uuidgen)" + + if [[ -z "$HOMEBREW_ANALYTICS_USER_UUID" ]] + then + # Avoid sending bogus analytics if no UUID could be generated. + export HOMEBREW_NO_ANALYTICS_THIS_RUN="1" + return + fi git config --file="$git_config_file" --replace-all homebrew.analyticsuuid "$HOMEBREW_ANALYTICS_USER_UUID" fi