seq(1) can count backwards on macOS; catch undefined variable use (#3735)

This commit is contained in:
tersec 2022-06-13 17:01:39 +00:00 committed by GitHub
parent 7b04a94d43
commit 0cedb1b6a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@
# Mostly a duplication of "tests/simulation/{start.sh,run_node.sh}", but with a focus on
# replicating testnets as closely as possible, which means following the Docker execution labyrinth.
set -e
set -eu
cd "$(dirname "${BASH_SOURCE[0]}")"/..
@ -62,6 +62,7 @@ BASE_METRICS_PORT="8008"
BASE_REST_PORT="7500"
REUSE_EXISTING_DATA_DIR="0"
REUSE_BINARIES="0"
NIMFLAGS=""
ENABLE_LOGTRACE="0"
STOP_AT_EPOCH_FLAG=""
TIMEOUT_DURATION="0"
@ -622,13 +623,19 @@ metrics = true
metrics-address = "127.0.0.1"
END_CLI_CONFIG
for NUM_REMOTE in $(seq 0 $(( REMOTE_SIGNER_NODES - 1 ))); do
# https://ss64.com/osx/seq.html documents that at macOS seq(1) counts backwards
# as probably do some others
if ((REMOTE_SIGNER_NODES > 0)); then
for NUM_REMOTE in $(seq 0 $(( REMOTE_SIGNER_NODES - 1 ))); do
# TODO find some way for this and other background-launched processes to
# still participate in set -e, ideally
./build/nimbus_signing_node \
--validators-dir="${DATA_DIR}/validators_shares/${NUM_REMOTE}" \
--secrets-dir="${DATA_DIR}/secrets_shares/${NUM_REMOTE}" \
--bind-port=$(( BASE_REMOTE_SIGNER_PORT + NUM_REMOTE )) \
> "${DATA_DIR}/log_remote_signer_${NUM_REMOTE}.txt" &
done
done
fi
# give each node time to load keys
sleep 10