From a7e2cc5decc5ec950cd4aa0e9cd0a5308adc820d Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Fri, 16 Sep 2022 12:13:52 +0200 Subject: [PATCH] Replace fgrep and egrep with grep -F/-E GNU Grep 3.8 reports the following warnings: egrep: warning: egrep is obsolescent; using grep -E fgrep: warning: fgrep is obsolescent; using grep -F (cherry picked from commit 212c4de043d3740dcf30c1f43c70fb89b324985d) --- bin/tests/system/autosign/tests.sh | 4 ++-- bin/tests/system/builtin/tests.sh | 4 ++-- bin/tests/system/cacheclean/tests.sh | 6 +++--- bin/tests/system/cds/tests.sh | 2 +- bin/tests/system/conf.sh.common | 4 ++-- bin/tests/system/dlzexternal/tests.sh | 2 +- bin/tests/system/inline/tests.sh | 2 +- bin/tests/system/metadata/tests.sh | 2 +- bin/tests/system/rndc/setup.sh | 2 +- bin/tests/system/rpz/tests.sh | 4 ++-- bin/tests/system/rrl/tests.sh | 12 ++++++------ bin/tests/system/sortlist/tests.sh | 8 ++++---- bin/tests/system/tsiggss/tests.sh | 2 +- 13 files changed, 27 insertions(+), 27 deletions(-) diff --git a/bin/tests/system/autosign/tests.sh b/bin/tests/system/autosign/tests.sh index 36edfe55d0..4dd241f8ef 100755 --- a/bin/tests/system/autosign/tests.sh +++ b/bin/tests/system/autosign/tests.sh @@ -1047,7 +1047,7 @@ END for i in 0 1 2 3 4 5 6 7 8 9; do ret=0 $DIG $DIGOPTS axfr secure-to-insecure.example @10.53.0.3 > dig.out.ns3.test$n || ret=1 - egrep '(RRSIG|DNSKEY|NSEC)' dig.out.ns3.test$n > /dev/null && ret=1 + grep -E '(RRSIG|DNSKEY|NSEC)' dig.out.ns3.test$n > /dev/null && ret=1 [ $ret -eq 0 ] && break echo_i "waiting ... ($i)" sleep 2 @@ -1066,7 +1066,7 @@ $SETTIME -I now -D now $file > settime.out.test$n.2 || ret=1 for i in 0 1 2 3 4 5 6 7 8 9; do ret=0 $DIG $DIGOPTS axfr secure-to-insecure2.example @10.53.0.3 > dig.out.ns3.test$n || ret=1 - egrep '(RRSIG|DNSKEY|NSEC3)' dig.out.ns3.test$n > /dev/null && ret=1 + grep -E '(RRSIG|DNSKEY|NSEC3)' dig.out.ns3.test$n > /dev/null && ret=1 [ $ret -eq 0 ] && break echo_i "waiting ... ($i)" sleep 2 diff --git a/bin/tests/system/builtin/tests.sh b/bin/tests/system/builtin/tests.sh index 2619f4d6a6..eb00a4578e 100644 --- a/bin/tests/system/builtin/tests.sh +++ b/bin/tests/system/builtin/tests.sh @@ -166,14 +166,14 @@ n=`expr $n + 1` ret=0 echo_i "Checking that default version works for rndc ($n)" $RNDCCMD 10.53.0.1 status > rndc.status.ns1.$n 2>&1 -fgrep "version: $BIND_VERSION_STRING" rndc.status.ns1.$n > /dev/null || ret=1 +grep -F "version: $BIND_VERSION_STRING" rndc.status.ns1.$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 custom version works for rndc ($n)" $RNDCCMD 10.53.0.3 status > rndc.status.ns3.$n 2>&1 -fgrep "version: $BIND_VERSION_STRING (this is a test of version)" rndc.status.ns3.$n > /dev/null || ret=1 +grep -F "version: $BIND_VERSION_STRING (this is a test of version)" rndc.status.ns3.$n > /dev/null || ret=1 if [ $ret != 0 ] ; then echo_i "failed"; status=`expr $status + $ret`; fi n=`expr $n + 1` diff --git a/bin/tests/system/cacheclean/tests.sh b/bin/tests/system/cacheclean/tests.sh index 127fae17e4..3669bba816 100755 --- a/bin/tests/system/cacheclean/tests.sh +++ b/bin/tests/system/cacheclean/tests.sh @@ -108,7 +108,7 @@ echo_i "reset and check that records are correctly cached initially ($n)" ret=0 load_cache dump_cache -nrecords=`filter_tree flushtest.example ns2/named_dump.db.test$n | egrep '(TXT|ANY)' | wc -l` +nrecords=`filter_tree flushtest.example ns2/named_dump.db.test$n | grep -E '(TXT|ANY)' | wc -l` [ $nrecords -eq 18 ] || { ret=1; echo_i "found $nrecords records expected 18"; } if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` @@ -202,7 +202,7 @@ n=`expr $n + 1` echo_i "check the number of cached records remaining ($n)" ret=0 dump_cache -nrecords=`filter_tree flushtest.example ns2/named_dump.db.test$n | grep -v '^;' | egrep '(TXT|ANY)' | wc -l` +nrecords=`filter_tree flushtest.example ns2/named_dump.db.test$n | grep -v '^;' | grep -E '(TXT|ANY)' | wc -l` [ $nrecords -eq 17 ] || { ret=1; echo_i "found $nrecords records expected 17"; } if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` @@ -220,7 +220,7 @@ n=`expr $n + 1` echo_i "check the number of cached records remaining ($n)" ret=0 dump_cache -nrecords=`filter_tree flushtest.example ns2/named_dump.db.test$n | egrep '(TXT|ANY)' | wc -l` +nrecords=`filter_tree flushtest.example ns2/named_dump.db.test$n | grep -E '(TXT|ANY)' | wc -l` [ $nrecords -eq 1 ] || { ret=1; echo_i "found $nrecords records expected 1"; } if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` diff --git a/bin/tests/system/cds/tests.sh b/bin/tests/system/cds/tests.sh index e70ec64eea..49a428b8db 100644 --- a/bin/tests/system/cds/tests.sh +++ b/bin/tests/system/cds/tests.sh @@ -42,7 +42,7 @@ testcase() { check_stderr() { if [ -n "${err:=}" ]; then - egrep "$err" err.$n >/dev/null && return 0 + grep -E "$err" err.$n >/dev/null && return 0 echo_d "stderr did not match '$err'" else [ -s err.$n ] || return 0 diff --git a/bin/tests/system/conf.sh.common b/bin/tests/system/conf.sh.common index cf35d0c994..e0811c8eaa 100644 --- a/bin/tests/system/conf.sh.common +++ b/bin/tests/system/conf.sh.common @@ -500,7 +500,7 @@ _search_log() ( nextpart "$file" | grep -F -e "$msg" > /dev/null ) -# _search_log_re: same as _search_log but the message is an egrep regex +# _search_log_re: same as _search_log but the message is an grep -E regex _search_log_re() ( msg="$1" file="$2" @@ -528,7 +528,7 @@ wait_for_log() ( return 1 ) -# wait_for_log_re: same as wait_for_log, but the message is an egrep regex +# wait_for_log_re: same as wait_for_log, but the message is an grep -E regex wait_for_log_re() ( timeout="$1" msg="$2" diff --git a/bin/tests/system/dlzexternal/tests.sh b/bin/tests/system/dlzexternal/tests.sh index 08ab8a4f90..9fd1ebe179 100644 --- a/bin/tests/system/dlzexternal/tests.sh +++ b/bin/tests/system/dlzexternal/tests.sh @@ -45,7 +45,7 @@ EOF return 1 } - out=`$DIG $DIGOPTS -t $type -q $host | egrep "^$host"` + out=`$DIG $DIGOPTS -t $type -q $host | grep -E "^$host"` lines=`echo "$out" | grep "$digout" | wc -l` [ $lines -eq 1 ] || { [ "$should_fail" ] || \ diff --git a/bin/tests/system/inline/tests.sh b/bin/tests/system/inline/tests.sh index 5d2df04add..12b381865a 100755 --- a/bin/tests/system/inline/tests.sh +++ b/bin/tests/system/inline/tests.sh @@ -1194,7 +1194,7 @@ wait_until_raw_zone_update_is_processed() { zone="$1" for i in 1 2 3 4 5 6 7 8 9 10 do - if nextpart ns3/named.run | egrep "zone ${zone}.*(sending notifies|receive_secure_serial)" > /dev/null; then + if nextpart ns3/named.run | grep -E "zone ${zone}.*(sending notifies|receive_secure_serial)" > /dev/null; then return fi sleep 1 diff --git a/bin/tests/system/metadata/tests.sh b/bin/tests/system/metadata/tests.sh index e75f8e9145..e8d442366a 100644 --- a/bin/tests/system/metadata/tests.sh +++ b/bin/tests/system/metadata/tests.sh @@ -91,7 +91,7 @@ echo_i "checking that standby KSK did not sign but is delegated ($n)" ret=0 grep " $rolling"'$' sigs > /dev/null && ret=1 grep " $rolling"'$' keys > /dev/null || ret=1 -egrep "DS[ ]*$rolling[ ]" ${pfile}.signed > /dev/null || ret=1 +grep -E "DS[ ]*$rolling[ ]" ${pfile}.signed > /dev/null || ret=1 n=$((n + 1)) if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) diff --git a/bin/tests/system/rndc/setup.sh b/bin/tests/system/rndc/setup.sh index 4dd6fa739e..5f638ef19e 100644 --- a/bin/tests/system/rndc/setup.sh +++ b/bin/tests/system/rndc/setup.sh @@ -43,7 +43,7 @@ copy_setports ns7/named.conf.in ns7/named.conf make_key () { $RNDCCONFGEN -k key$1 -A $3 -s 10.53.0.4 -p $2 \ > ns4/key${1}.conf 2> /dev/null - egrep -v '(^# Start|^# End|^# Use|^[^#])' ns4/key$1.conf | cut -c3- | \ + grep -E -v '(^# Start|^# End|^# Use|^[^#])' ns4/key$1.conf | cut -c3- | \ sed 's/allow { 10.53.0.4/allow { any/' >> ns4/named.conf } diff --git a/bin/tests/system/rpz/tests.sh b/bin/tests/system/rpz/tests.sh index 9975b686cf..7f76729bfa 100644 --- a/bin/tests/system/rpz/tests.sh +++ b/bin/tests/system/rpz/tests.sh @@ -829,10 +829,10 @@ EOF # look for complaints from lib/dns/rpz.c and bin/name/query.c for runfile in ns*/named.run; do - EMSGS=`nextpart $runfile | egrep -l 'invalid rpz|rpz.*failed'` + EMSGS=`nextpart $runfile | grep -E -l 'invalid rpz|rpz.*failed'` if test -n "$EMSGS"; then setret "error messages in $runfile starting with:" - egrep 'invalid rpz|rpz.*failed' ns*/named.run | \ + grep -E 'invalid rpz|rpz.*failed' ns*/named.run | \ sed -e '10,$d' -e 's/^//' | cat_i fi done diff --git a/bin/tests/system/rrl/tests.sh b/bin/tests/system/rrl/tests.sh index e3207ca1cd..8e1999ab3b 100644 --- a/bin/tests/system/rrl/tests.sh +++ b/bin/tests/system/rrl/tests.sh @@ -108,14 +108,14 @@ ck_result() { # wait to the background mdig calls to complete. wait BAD=no - ADDRS=`egrep "^$2$" mdig.out-$1 2>/dev/null | wc -l` + ADDRS=`grep -E "^$2$" mdig.out-$1 2>/dev/null | wc -l` # count simple truncated and truncated NXDOMAIN as TC - TC=`egrep "^TC|NXDOMAINTC$" mdig.out-$1 2>/dev/null | wc -l` - DROP=`egrep "^drop$" mdig.out-$1 2>/dev/null | wc -l` + TC=`grep -E "^TC|NXDOMAINTC$" mdig.out-$1 2>/dev/null | wc -l` + DROP=`grep -E "^drop$" mdig.out-$1 2>/dev/null | wc -l` # count NXDOMAIN and truncated NXDOMAIN as NXDOMAIN - NXDOMAIN=`egrep "^NXDOMAIN|NXDOMAINTC$" mdig.out-$1 2>/dev/null | wc -l` - SERVFAIL=`egrep "^SERVFAIL$" mdig.out-$1 2>/dev/null | wc -l` - NOERROR=`egrep "^NOERROR$" mdig.out-$1 2>/dev/null | wc -l` + NXDOMAIN=`grep -E "^NXDOMAIN|NXDOMAINTC$" mdig.out-$1 2>/dev/null | wc -l` + SERVFAIL=`grep -E "^SERVFAIL$" mdig.out-$1 2>/dev/null | wc -l` + NOERROR=`grep -E "^NOERROR$" mdig.out-$1 2>/dev/null | wc -l` range $ADDRS "$3" 1 || setret "$ADDRS instead of $3 '$2' responses for $1" && diff --git a/bin/tests/system/sortlist/tests.sh b/bin/tests/system/sortlist/tests.sh index 4ff9dd3769..f55cf0abb0 100644 --- a/bin/tests/system/sortlist/tests.sh +++ b/bin/tests/system/sortlist/tests.sh @@ -38,13 +38,13 @@ b.example. 300 IN A 10.53.0.$n EOF $DIG $DIGOPTS b.example. @10.53.0.1 -b 10.53.0.2 | sed 1q | \ - egrep '10.53.0.(2|3)$' > test2.out && + grep -E '10.53.0.(2|3)$' > test2.out && $DIG $DIGOPTS b.example. @10.53.0.1 -b 10.53.0.3 | sed 1q | \ - egrep '10.53.0.(2|3)$' >> test2.out && + grep -E '10.53.0.(2|3)$' >> test2.out && $DIG $DIGOPTS b.example. @10.53.0.1 -b 10.53.0.4 | sed 1q | \ - egrep '10.53.0.4$' >> test2.out && + grep -E '10.53.0.4$' >> test2.out && $DIG $DIGOPTS b.example. @10.53.0.1 -b 10.53.0.5 | sed 1q | \ - egrep '10.53.0.5$' >> test2.out || status=1 + grep -E '10.53.0.5$' >> test2.out || status=1 echo_i "exit status: $status" [ $status -eq 0 ] || exit 1 diff --git a/bin/tests/system/tsiggss/tests.sh b/bin/tests/system/tsiggss/tests.sh index d79cec1199..ee592bb470 100644 --- a/bin/tests/system/tsiggss/tests.sh +++ b/bin/tests/system/tsiggss/tests.sh @@ -54,7 +54,7 @@ EOF return 1 } - out=`$DIG $DIGOPTS -t $type -q $host | egrep "^${host}"` + out=`$DIG $DIGOPTS -t $type -q $host | grep -E "^${host}"` lines=`echo "$out" | grep "$digout" | wc -l` [ $lines -eq 1 ] || { echo_i "dig output incorrect for $host $type $cmd: $out"