From 481dfb96715d383145af15432b3b3b7d81373636 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Tue, 27 Oct 2020 10:20:05 +0100 Subject: [PATCH 1/2] Get rid of bashisms in string comparisons The double equal sign ('==') is a Bash-specific string comparison operator. Ensure the single equal sign ('=') is used in all POSIX shell scripts in the system test suite in order to retain their portability. --- bin/tests/system/kasp/tests.sh | 8 ++++---- bin/tests/system/rpz/tests.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/tests/system/kasp/tests.sh b/bin/tests/system/kasp/tests.sh index 378df45fa3..e875e406c9 100644 --- a/bin/tests/system/kasp/tests.sh +++ b/bin/tests/system/kasp/tests.sh @@ -5661,10 +5661,10 @@ dnssec_verify n=$((n+1)) echo_i "check that of zone ${ZONE} migration to dnssec-policy uses the same keys ($n)" ret=0 -[ $_migrate_ext8_ksk == $_migrate_int8_ksk ] || log_error "mismatch ksk tag" -[ $_migrate_ext8_zsk == $_migrate_int8_zsk ] || log_error "mismatch zsk tag" -[ $_migrate_ext8_ksk == $(key_get KEY1 ID) ] || log_error "mismatch ksk tag" -[ $_migrate_ext8_zsk == $(key_get KEY2 ID) ] || log_error "mismatch zsk tag" +[ $_migrate_ext8_ksk = $_migrate_int8_ksk ] || log_error "mismatch ksk tag" +[ $_migrate_ext8_zsk = $_migrate_int8_zsk ] || log_error "mismatch zsk tag" +[ $_migrate_ext8_ksk = $(key_get KEY1 ID) ] || log_error "mismatch ksk tag" +[ $_migrate_ext8_zsk = $(key_get KEY2 ID) ] || log_error "mismatch zsk tag" status=$((status+ret)) echo_i "exit status: $status" diff --git a/bin/tests/system/rpz/tests.sh b/bin/tests/system/rpz/tests.sh index d73ccb939e..c728c45d5c 100644 --- a/bin/tests/system/rpz/tests.sh +++ b/bin/tests/system/rpz/tests.sh @@ -208,7 +208,7 @@ restart () { fi fi rm -f ns$1/*.jnl - if [ "$2" == "rebuild-bl-rpz" ]; then + if [ "$2" = "rebuild-bl-rpz" ]; then if test -f ns$1/base.db; then for NM in ns$1/bl*.db; do cp -f ns$1/base.db $NM From c0c4c024c64018aefe655103fcba6f6fa9ec7581 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Tue, 27 Oct 2020 10:30:21 +0100 Subject: [PATCH 2/2] Replace a seq invocation with a shell loop seq is not portable. Use a while loop instead to make the "dnssec" system test script POSIX-compatible. --- bin/tests/system/dnssec/ns2/sign.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/tests/system/dnssec/ns2/sign.sh b/bin/tests/system/dnssec/ns2/sign.sh index dfe35fea9d..1bfaa37a04 100644 --- a/bin/tests/system/dnssec/ns2/sign.sh +++ b/bin/tests/system/dnssec/ns2/sign.sh @@ -196,8 +196,10 @@ cat > "$zonefile" << EOF ns2 10 A 10.53.0.2 ns3 10 A 10.53.0.3 EOF -for i in $(seq 300); do +i=1 +while [ $i -le 300 ]; do echo "host$i 10 IN NS ns.elsewhere" + i=$((i+1)) done >> "$zonefile" key1=$("$KEYGEN" -q -a "$DEFAULT_ALGORITHM" -b "$DEFAULT_BITS" -n zone -f KSK "$zone") key2=$("$KEYGEN" -q -a "$DEFAULT_ALGORITHM" -b "$DEFAULT_BITS" -n zone "$zone")