From ae33a8ddeae6bc1398377fec8277ea50cc7dfc00 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Thu, 8 Sep 2022 17:12:46 +0200 Subject: [PATCH] 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. --- bin/tests/system/builtin/tests.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/tests/system/builtin/tests.sh b/bin/tests/system/builtin/tests.sh index 1ed88721de..898fd522e9 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`