]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Test that +short does not leak the ";; " comments 12416/head
authorMartin Basti <mbasti@isc.org>
Tue, 21 Jul 2026 13:49:00 +0000 (13:49 +0000)
committerMartin Basti <mbasti@isc.org>
Tue, 21 Jul 2026 19:28:09 +0000 (21:28 +0200)
Plain +short already turns lookup->comments off, so the regression it
guards against only surfaces with "+short +comments", where +comments
re-enables the comment toggle while short form is still in effect.  The
existing silent-then-servfail scenario is reused because its retry path
reliably prints a "Got SERVFAIL reply from ..." comment; the +comments
case (without +short) is asserted first so the absence check is
meaningful.

Assisted-by: Claude:claude-opus-4-8
bin/tests/system/digdelv/tests.sh

index bbdbe531d46a67dab00d1ff6f65aebfceda2b5f9..17587f7ab90f772ab424b383f9f9a7e846c5a648 100644 (file)
@@ -1342,6 +1342,28 @@ if [ -x "$DIG" ]; then
   if [ $ret -ne 0 ]; then echo_i "failed"; fi
   status=$((status + ret))
 
+  # With +short, dig must not emit the ";; " progress/error comments (here:
+  # the "Got SERVFAIL reply from ..." note printed while retrying).  +short
+  # normally turns comments off, but "+short +comments" re-enables them while
+  # short form is still in effect; the comment output then belongs to the
+  # verbose form and would corrupt the short output.  The "+comments" case
+  # (without +short) is checked first so the absence check below is meaningful.
+  n=$((n + 1))
+  echo_i "check that dig +comments emits the retry comment ($n)"
+  ret=0
+  dig_with_opts +timeout=1 +nofail +comments @10.53.0.7 silent-then-servfail.example >dig.out.test$n 2>&1 || ret=1
+  grep -F ";; Got SERVFAIL reply from" dig.out.test$n >/dev/null || ret=1
+  if [ $ret -ne 0 ]; then echo_i "failed"; fi
+  status=$((status + ret))
+
+  n=$((n + 1))
+  echo_i "check that dig +short +comments suppresses the retry comment ($n)"
+  ret=0
+  dig_with_opts +timeout=1 +nofail +short +comments @10.53.0.7 silent-then-servfail.example >dig.out.test$n 2>&1 || ret=1
+  grep -F ";; Got SERVFAIL reply from" dig.out.test$n >/dev/null && ret=1
+  if [ $ret -ne 0 ]; then echo_i "failed"; fi
+  status=$((status + ret))
+
   n=$((n + 1))
   echo_i "check that dig tries the next server after a UDP socket network unreachable error ($n)"
   ret=0