From: Michal Nowak Date: Thu, 8 Sep 2022 15:12:46 +0000 (+0200) Subject: Rename $HOSTNAME to $HOST_NAME to silence checkbashisms X-Git-Tag: v9.19.8~57^2~2 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=ae33a8ddeae6bc1398377fec8277ea50cc7dfc00;p=thirdparty%2Fbind9.git Rename $HOSTNAME to $HOST_NAME to silence checkbashisms checkbashisms warns about possible reliance on HOSTNAME environmental variable which Bash sets to the name of the current host, and some commands may leverage it: possible bashism in builtin/tests.sh line 199 ($HOST(TYPE|NAME)): grep "^\"$HOSTNAME\"$" dig.out.ns1.$n > /dev/null || ret=1 possible bashism in builtin/tests.sh line 221 ($HOST(TYPE|NAME)): grep "^\"$HOSTNAME\"$" dig.out.ns2.$n > /dev/null || ret=1 possible bashism in builtin/tests.sh line 228 ($HOST(TYPE|NAME)): grep "^; NSID: .* (\"$HOSTNAME\")$" dig.out.ns2.$n > /dev/null || ret=1 We don't use the variable this way but rename it to HOST_NAME to silence the tool. --- diff --git a/bin/tests/system/builtin/tests.sh b/bin/tests/system/builtin/tests.sh index 1ed88721de0..898fd522e9f 100644 --- a/bin/tests/system/builtin/tests.sh +++ b/bin/tests/system/builtin/tests.sh @@ -160,7 +160,7 @@ sleep 1 grep "zone serial (0) unchanged." ns1/named.run > /dev/null && ret=1 if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi -HOSTNAME=`$FEATURETEST --gethostname` +HOST_NAME=`$FEATURETEST --gethostname` BIND_VERSION_STRING=$($NAMED -V | head -1) BIND_VERSION=$($NAMED -V | sed -ne 's/^BIND \([^ ]*\).*/\1/p') @@ -196,7 +196,7 @@ n=`expr $n + 1` ret=0 echo_i "Checking that default hostname works for query ($n)" $DIG $DIGOPTS +short hostname.bind txt ch @10.53.0.1 > dig.out.ns1.$n -grep "^\"$HOSTNAME\"$" dig.out.ns1.$n > /dev/null || ret=1 +grep "^\"$HOST_NAME\"$" dig.out.ns1.$n > /dev/null || ret=1 if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi n=`expr $n + 1` @@ -218,14 +218,14 @@ n=`expr $n + 1` ret=0 echo_i "Checking that server-id hostname works for query ($n)" $DIG $DIGOPTS +short id.server txt ch @10.53.0.2 > dig.out.ns2.$n -grep "^\"$HOSTNAME\"$" dig.out.ns2.$n > /dev/null || ret=1 +grep "^\"$HOST_NAME\"$" dig.out.ns2.$n > /dev/null || ret=1 if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi n=`expr $n + 1` ret=0 echo_i "Checking that server-id hostname works for EDNS name server ID request ($n)" $DIG $DIGOPTS +norec +nsid foo @10.53.0.2 > dig.out.ns2.$n -grep "^; NSID: .* (\"$HOSTNAME\")$" dig.out.ns2.$n > /dev/null || ret=1 +grep "^; NSID: .* (\"$HOST_NAME\")$" dig.out.ns2.$n > /dev/null || ret=1 if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi n=`expr $n + 1`