From aecc9e6ef523919d05e5a99705e8b9a6f4b8f11f Mon Sep 17 00:00:00 2001 From: Boris Shingarov Date: Fri, 21 Dec 2018 06:08:34 -0500 Subject: [PATCH 1/2] Check sanity of curled gzip data The getGoodSpur*VM.sh scripts assume that the VM mentioned in the topmost notification, is always there on bintray. This is not always the case. Unfortunately, bintray will not return a 404 code on a 404 error, but instead give a 200 with garbage data. While we can't do anything about that, at least make an attempt to bail if the file doesn't even look like gzip-compressed data. --- image/getGoodSpur64VM.sh | 9 ++++++++- image/getGoodSpurVM.sh | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/image/getGoodSpur64VM.sh b/image/getGoodSpur64VM.sh index fa04e433a4..3267384532 100755 --- a/image/getGoodSpur64VM.sh +++ b/image/getGoodSpur64VM.sh @@ -52,7 +52,14 @@ else exit fi curl -L "$URL" -o "$LATESTVM" - tar xzf "$LATESTVM" + # bug in bintray: on a 404 error, + # it will return a 200 with garbage data + if [[ $(file "$LATESTVM" | grep 'gzip compressed data') ]]; then + tar xzf "$LATESTVM" + else + echo No gzip data at "$URL" + exit + fi mv sqcogspur64linuxht $VM rm -f "$LATESTVM" fi diff --git a/image/getGoodSpurVM.sh b/image/getGoodSpurVM.sh index 27516e5136..5e22cf4aa6 100755 --- a/image/getGoodSpurVM.sh +++ b/image/getGoodSpurVM.sh @@ -52,6 +52,14 @@ else exit fi curl -L "$URL" -o "$LATESTVM" + # bug in bintray: on a 404 error, + # it will return a 200 with garbage data + if [[ $(file "$LATESTVM" | grep 'gzip compressed data') ]]; then + tar xzf "$LATESTVM" + else + echo No gzip data at "$URL" + exit + fi tar xzf "$LATESTVM" mv sqcogspurlinuxht $VM rm -f "$LATESTVM" From a2bdae44dd893df996734cff5ddcadf0dca112b6 Mon Sep 17 00:00:00 2001 From: Boris Shingarov Date: Fri, 21 Dec 2018 06:08:34 -0500 Subject: [PATCH 2/2] Check sanity of curled gzip data The getGoodSpur*VM.sh scripts assume that the VM mentioned in the topmost notification, is always there on bintray. This is not always the case. Unfortunately, bintray will not return a 404 code on a 404 error, but instead give a 200 with garbage data. While we can't do anything about that, at least make an attempt to bail if the file doesn't even look like gzip-compressed data. --- image/getGoodSpur64VM.sh | 9 ++++++++- image/getGoodSpurVM.sh | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/image/getGoodSpur64VM.sh b/image/getGoodSpur64VM.sh index fa04e433a4..3267384532 100755 --- a/image/getGoodSpur64VM.sh +++ b/image/getGoodSpur64VM.sh @@ -52,7 +52,14 @@ else exit fi curl -L "$URL" -o "$LATESTVM" - tar xzf "$LATESTVM" + # bug in bintray: on a 404 error, + # it will return a 200 with garbage data + if [[ $(file "$LATESTVM" | grep 'gzip compressed data') ]]; then + tar xzf "$LATESTVM" + else + echo No gzip data at "$URL" + exit + fi mv sqcogspur64linuxht $VM rm -f "$LATESTVM" fi diff --git a/image/getGoodSpurVM.sh b/image/getGoodSpurVM.sh index 27516e5136..5e22cf4aa6 100755 --- a/image/getGoodSpurVM.sh +++ b/image/getGoodSpurVM.sh @@ -52,6 +52,14 @@ else exit fi curl -L "$URL" -o "$LATESTVM" + # bug in bintray: on a 404 error, + # it will return a 200 with garbage data + if [[ $(file "$LATESTVM" | grep 'gzip compressed data') ]]; then + tar xzf "$LATESTVM" + else + echo No gzip data at "$URL" + exit + fi tar xzf "$LATESTVM" mv sqcogspurlinuxht $VM rm -f "$LATESTVM"