2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

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
This commit is contained in:
Michal Nowak
2022-09-16 12:13:52 +02:00
committed by Ondřej Surý
parent 65e91ef5e6
commit 212c4de043
13 changed files with 27 additions and 27 deletions

View File

@@ -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

View 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`

View File

@@ -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`

View 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

View 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"

View 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" ] || \

View File

@@ -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

View 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))

View 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
}

View 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

View 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" &&

View 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

View 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"