Unverified Commit 4bf29894 authored by Mattia Rizzolo's avatar Mattia Rizzolo
Browse files

reproducible: health_check: fix a (nonfatal?) syntax error

This was causing:
/tmp/jenkins-script-vkjPKnSH: line 116: "2019" + 1: syntax error: operand expected (error token is ""2019" + 1")

Turns out that within arithmetic variables using $ is discuraged due to
how the expansion is done, and this was indeed leading to a subtle bug
here.
Should have followed shellcheck in the first instance.
https://github.com/koalaman/shellcheck/wiki/SC2004


Curiously, not double-quoting the variables within whould have _also_
prevented this bug (in a different way).

Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent 05eae000
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -113,8 +113,8 @@ if "$NODE_RUN_IN_THE_FUTURE"; then
	if [ "$year" -eq "$real_year" ]; then
		echo "Warning, today we came back to the present: $(date -u)."
		DIRTY=true
	elif [ "$year" -eq "$(("$real_year" + 1))" ] || \
		 [ "$year" -eq "$(("$real_year" + 2))" -a "$(date +%m)" -eq 1 ]; then
	elif [ "$year" -eq "$((real_year + 1))" ] || \
		 [ "$year" -eq "$((real_year + 2))" -a "$(date +%m)" -eq 1 ]; then
		echo "Good, today is the right future: $(date -u)."
	else
		echo "Warning, today is the wrong future: $(date -u)."