production-verify: Don’t assume lengths have a decimal point.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-06-09 15:38:40 -07:00 committed by Tim Abbott
parent 99e6f25c4e
commit 9e5f382241
1 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,7 @@ if [ -f /etc/os-release ]; then
fi fi
check_header() { check_header() {
sed -i -e 's|Length: [0-9]\+\( [(][0-9]\+[.][0-9]K[)]\)\?|Length: <Length>|' -e "s|{nginx_version_string}|$nginx_version|g" "$success_header_file" sed -i -e 's|Length: [0-9]\+\( ([0-9.]\+K)\)\?|Length: <Length>|' -e "s|{nginx_version_string}|$nginx_version|g" "$success_header_file"
if ! diff -ur /tmp/http-headers-processed "$success_header_file"; then if ! diff -ur /tmp/http-headers-processed "$success_header_file"; then
set +x set +x
echo echo
@ -73,7 +73,7 @@ grep -vi '\(Vary\|Content-Language\|expires\|issued by\|modified\|saved\|[.][.][
nginx_version="$(nginx -v 2>&1 | awk '{print $3, $4}' | xargs)" nginx_version="$(nginx -v 2>&1 | awk '{print $3, $4}' | xargs)"
# Simplify the diff by getting replacing 4-5 digit length numbers with <Length>. # Simplify the diff by getting replacing 4-5 digit length numbers with <Length>.
sed -i 's|Length: [0-9]\+\( [(][0-9]\+[.][0-9]K[)]\)\?|Length: <Length>|' /tmp/http-headers-processed sed -i 's|Length: [0-9]\+\( ([0-9.]\+K)\)\?|Length: <Length>|' /tmp/http-headers-processed
if [ "$os_version_codename" = "buster" ] || [ "$os_version_codename" = "bullseye" ]; then if [ "$os_version_codename" = "buster" ] || [ "$os_version_codename" = "bullseye" ]; then
success_header_file="/tmp/success-http-headers.template.debian.txt" success_header_file="/tmp/success-http-headers.template.debian.txt"
check_header check_header