]> 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:12:02 +0000 (09:12 +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

(cherry picked from commit 212c4de043d3740dcf30c1f43c70fb89b324985d)

12 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/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 4d63c389506caa0ccb1ecdee746416773bfab04a..309e938f2778f2578832aa5fc502c102ce954f5d 100755 (executable)
@@ -1040,7 +1040,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
@@ -1059,7 +1059,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 482f31733a2a26d862bc165a1a4ca4d2f9b6f239..af89dae862f16aedb1467882edb812c75c15af3b 100644 (file)
@@ -167,14 +167,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 ef13f0f010a4c46f54d31a568a09239433134fb2..033caf001b789d7ddc886b221c8957b1248ee942 100755 (executable)
@@ -109,7 +109,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`
@@ -203,7 +203,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`
@@ -221,7 +221,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 81630fcb04469321b061c37739f9b5de4fb5b0bf..700ae635a80f1bdb273a44ce210cd1f7ddd06d97 100644 (file)
@@ -43,7 +43,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 1e48fc8770c5db43c0ddb58318c0449501363a24..ab35051c7d4d5653ab71d7b08b5e571866b50f69 100644 (file)
@@ -46,7 +46,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 c5c036ca7f28cefc94b8bbba9bbd0344d7b787fe..3397fe1032afd66b847d77b75d8b53c34d3094dc 100755 (executable)
@@ -1195,7 +1195,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 9d81a87395bc0683e99713b25b34c36f2d959005..626559de910f728fca54d1337038b9f2ce82eae3 100644 (file)
@@ -92,7 +92,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 5626eeba123833a95a7edcedba394fa67481cc84..e7df6e4933b00ee45dad9e092466e10a256fed6b 100644 (file)
@@ -36,7 +36,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 9fc5d08cf23a0b4f9fe11b00149dd0c913f459a5..6ee11fad2f2bccc94fb2935b2d7edaea81c8ab30 100644 (file)
@@ -827,10 +827,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 911ccd11d4ad95842e7d50a56fa370ee2cb56996..2e7326317cc2d44102ff9d4edaea1a7dcbd1a906 100644 (file)
@@ -110,14 +110,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 5d88d1d83390bb6148f013b242470cbe38b04d22..b290a99efbdbe855be517f0cc10d995682d6fefd 100644 (file)
@@ -39,13 +39,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 c090d33b2e65c22802f6f49989c212741e56caed..2d5dc8e06ed42c5b3d14b6d881c1cd3fd7ab4770 100644 (file)
@@ -55,7 +55,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"