grep from FreeBSD 13.0 stumbles on '\r' in digdelv test
grep from FreeBSD 13.0 stumbles on \r
in the digdelv system test:
I:digdelv:check that dig +bufsize=0 +edns sends EDNS with bufsize of 0 (81)
grep: trailing backslash (\)
I:digdelv:failed
This is because, according to FreeBSD 13.0 release notes, FreeBSD 13.0 uses BSD grep instead of GNU grep:
The BSD version of grep(1) is now installed by default. The obsolete GNU version that was the previous default has been removed. 8aff76fb37b5, 47d1ad2413da
Which also recently dropped support for escape codes:
The regex(3) function no longer accepts redundant escapes for most ordinary characters. This will cause applications such as sed(1) and grep(1) to reject regular expressions using these escapes. adeebf4cd47c
[newman@freebsd13 ~/bind9/bin/tests/system]$ grep -E 'EDNS:.* udp: 0\r{0,1}$' digdelv/dig.out.test81
grep: trailing backslash (\)
[newman@freebsd13 ~/bind9/bin/tests/system]$ /usr/local/bin/grep -E 'EDNS:.* udp: 0\r{0,1}$' digdelv/dig.out.test81
; EDNS: version: 0, flags:; udp: 0
grep
from FreeBSD 11.4 and 12.2 does not exhibit this problem, because it's actually GNU grep 2.5.
This appears to be the fix:
diff --git a/bin/tests/system/digdelv/tests.sh b/bin/tests/system/digdelv/tests.sh
index 099e08e87e..9d1f5171d5 100644
--- a/bin/tests/system/digdelv/tests.sh
+++ b/bin/tests/system/digdelv/tests.sh
@@ -975,7 +975,8 @@ if [ -x "$DIG" ] ; then
echo_i "check that dig +bufsize=0 +edns sends EDNS with bufsize of 0 ($n)"
ret=0
dig_with_opts @10.53.0.3 a.example +bufsize=0 +edns +qr > dig.out.test$n 2>&1 || ret=1
- grep -E 'EDNS:.* udp: 0\r{0,1}$' dig.out.test$n > /dev/null|| ret=1
+ pat='EDNS:.* udp: 0{0,1}$'
+ tr -d '\r' < dig.out.test$n | grep -E "$pat" > /dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))