From 46eb0fed75554a03acbd72c7c4e89acd49cfe804 Mon Sep 17 00:00:00 2001 From: dmiller Date: Tue, 3 Dec 2013 19:11:12 +0000 Subject: [PATCH] Be more compatible with SysV sh Although $((arithmetic expansion)) is POSIX-specified, some systems have non-POSIX System V shell, which can't handle it. This patch replaces $((something)) with $(expr something) to fix compatibility. This actually slows things down considerably, since a subshell must be launched for each increment operation, but the tests aren't that critical. Bug report: http://seclists.org/nmap-dev/2013/q4/198 --- ncat/test/test-addrset.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ncat/test/test-addrset.sh b/ncat/test/test-addrset.sh index d0e1b6637..49614c526 100755 --- a/ncat/test/test-addrset.sh +++ b/ncat/test/test-addrset.sh @@ -19,17 +19,17 @@ test_addrset() { ret=$? # Change newlines to spaces. result=$(echo $result) - TESTS=$((TESTS + 1)); + TESTS=$(expr $TESTS + 1); if [ "$ret" != "0" ]; then echo "FAIL $ADDRSET returned $ret." - TEST_FAIL=$((TEST_FAIL + 1)) + TEST_FAIL=$(expr $TEST_FAIL + 1) elif [ "$result" != "$expected" ]; then echo "FAIL \"$result\" !=" echo " \"$expected\"." - TEST_FAIL=$((TEST_FAIL + 1)) + TEST_FAIL=$(expr $TEST_FAIL + 1) else echo "PASS $specs" - TEST_PASS=$((TEST_PASS + 1)) + TEST_PASS=$(expr $TEST_PASS + 1) fi } @@ -39,13 +39,13 @@ expect_fail() { specs=$1 $ADDRSET $specs < /dev/null 2> /dev/null ret=$? - TESTS=$((TESTS + 1)) + TESTS=$(expr $TESTS + 1) if [ "$ret" = "0" ]; then echo "FAIL $ADDRSET $specs was expected to fail, but didn't." - TEST_FAIL=$((TEST_FAIL + 1)) + TEST_FAIL=$(expr $TEST_FAIL + 1) else echo "PASS $specs" - TEST_PASS=$((TEST_PASS + 1)) + TEST_PASS=$(expr $TEST_PASS + 1) fi } @@ -55,7 +55,7 @@ seq() { high=$2 while [ $low -le $high ]; do echo $low - low=$((low + 1)) + low=$(expr $low + 1) done }