aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Afanasjew2016-06-29 14:05:40 +0200
committerMartin Afanasjew2016-06-29 21:07:25 +0200
commit271023c5e11ec5fc8be39a2161c43b2ffd034ce6 (patch)
treeeb239c7ee4eac3a1725360abe98d1b8a4d82c271
parentdb76a0f4cc3838658919570b3453edbcb9ed2fcd (diff)
downloadbrew-271023c5e11ec5fc8be39a2161c43b2ffd034ce6.tar.bz2
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.
-rw-r--r--Library/Homebrew/utils/analytics.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/Library/Homebrew/utils/analytics.sh b/Library/Homebrew/utils/analytics.sh
index 37148dd43..f0ec2c46e 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