[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] reproducible: health_check: fix a (nonfatal?) syntax error
Mattia Rizzolo
gitlab at salsa.debian.org
Sun Jan 13 09:38:22 GMT 2019
Mattia Rizzolo pushed to branch master at Debian QA / jenkins.debian.net
Commits:
4bf29894 by Mattia Rizzolo at 2019-01-13T09:35:47Z
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 <mattia at debian.org>
- - - - -
1 changed file:
- bin/reproducible_node_health_check.sh
Changes:
=====================================
bin/reproducible_node_health_check.sh
=====================================
@@ -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)."
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/4bf29894706ca64f2e87caa4eb4eefeee49a32ba
--
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/4bf29894706ca64f2e87caa4eb4eefeee49a32ba
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20190113/9e32c253/attachment-0001.html>
More information about the Qa-jenkins-scm
mailing list