]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Replace fgrep and egrep with grep -F/-E
authorMichal Nowak <mnowak@isc.org>
Fri, 16 Sep 2022 10:13:52 +0000 (12:13 +0200)
committerOndřej Surý <ondrej@isc.org>
Mon, 17 Oct 2022 07:08:15 +0000 (09:08 +0200)
GNU Grep 3.8 reports the following warnings:

    egrep: warning: egrep is obsolescent; using grep -E
    fgrep: warning: fgrep is obsolescent; using grep -F

13 files changed:
bin/tests/system/autosign/tests.sh
bin/tests/system/builtin/tests.sh
bin/tests/system/cacheclean/tests.sh
bin/tests/system/cds/tests.sh
bin/tests/system/conf.sh.common
bin/tests/system/dlzexternal/tests.sh
bin/tests/system/inline/tests.sh
bin/tests/system/metadata/tests.sh
bin/tests/system/rndc/setup.sh
bin/tests/system/rpz/tests.sh
bin/tests/system/rrl/tests.sh
bin/tests/system/sortlist/tests.sh
bin/tests/system/tsiggss/tests.sh

index 36edfe55d0dea61b5bd1e8e8284918d02656aa5b..4dd241f8efbadf37aec28e2fae06fa3b9e69b306 100755 (executable)
@@ -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
index 2619f4d6a60f0fba776eea2174686cc4b9b32694..eb00a4578ed8fa0d81b3932c52a1f4ec636f324a 100644 (file)
@@ -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`
index 127fae17e463b37d95af069074ec2b98bba00872..3669bba816c03d1298bf9e31f0fb516bd4eccca3 100755 (executable)
@@ -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`
index e70ec64eeac6f813b0d122266650ccf1ebdd9e66..49a428b8db7c09fdc686b756aa689277a6c10d3a 100644 (file)
@@ -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
index bf820bb275fb7a4cba26d0308ac37cf91fc790ef..c3a84d8d9db1663a43dd604b33d35ab7257e6e7e 100644 (file)
@@ -493,7 +493,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"
@@ -521,7 +521,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"
index 08ab8a4f900ccf8dc1c1be07f5b018ec6d127168..9fd1ebe179ee50494c14bad0bf448bc6df93a71c 100644 (file)
@@ -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" ] || \
index 5d2df04addad04d3dd28c78f57e041f58242a536..12b381865ab2acfdb302612a3f93bd8a24edc741 100755 (executable)
@@ -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
index e75f8e91456c2b67f577f62898ab7ee55e2f5fab..e8d442366aa28bd8524e2c3fe56eaaefab6c2335 100644 (file)
@@ -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))
index 3c4de1292d86e5b9da2d49fc60f6f77b9f288bd0..a8793f36d9fc61a97e4ab819eabc6085a93f045c 100644 (file)
@@ -44,7 +44,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
 }
 
index 194527c1a832d694e6b28e3ae83306b820bde864..22b0ebb3085a105315c0513338d9d9e27eef92aa 100644 (file)
@@ -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
index e3207ca1cde4facf43e6a9c5c13de96108c3a8ba..8e1999ab3b864522e9c89b427ad56ae32e22b30e 100644 (file)
@@ -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" &&
index 4ff9dd3769406d0a4cfc12cd12f05f8adc6513aa..f55cf0abb0ca8b9cfb84adee8c5962768fc3dc9a 100644 (file)
@@ -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
index d79cec11990fccf208b606a29523c92f2b87c638..ee592bb470568a90bfe058e618ba9e98504b4300 100644 (file)
@@ -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"