]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Ignore comments when comparing built-in root hints to named.root 12479/head
authorNicki Křížek <nicki@isc.org>
Thu, 30 Jul 2026 08:40:16 +0000 (08:40 +0000)
committerNicki Křížek <nicki@isc.org>
Thu, 30 Jul 2026 08:40:16 +0000 (08:40 +0000)
InterNIC periodically republishes named.root with only the "last
update" and "related version of root zone" comments changed, which
failed the live-internet check even though the actual records were
unchanged. Updating the built-in hints for comment-only churn is
pointless, so compare just the resource records.

Assisted-by: Claude:claude-fable-5
bin/tests/system/tools/tests_tools_named_root_hints.py

index 685093f9fad55e51a14559de70b44daf07c54815..e8ac7203743402df2d130b9419cc35c70fdd3e8d 100644 (file)
@@ -20,6 +20,16 @@ pytestmark = [isctest.mark.live_internet_test]
 NAMED_ROOT_URL = "https://www.internic.net/zones/named.root"
 
 
+def strip_comments(text):
+    """Return only the resource records, without comments and blank lines."""
+    records = []
+    for line in text.splitlines():
+        line = line.split(";", 1)[0].rstrip()
+        if line:
+            records.append(line)
+    return records
+
+
 def test_named_root_hints():
     """
     Test that 'named -H' output matches the official
@@ -28,13 +38,12 @@ def test_named_root_hints():
     resp = requests.get(NAMED_ROOT_URL, timeout=30)
     resp.raise_for_status()
 
-    # the last line misses newline character, named ensures all lines have posix ends
-    internic_content = resp.text + "\n"
+    internic_records = strip_comments(resp.text)
 
     named = isctest.vars.ALL["NAMED"]
     cmd = isctest.run.cmd([named, "-H"])
-    builtin_content = cmd.out
+    builtin_records = strip_comments(cmd.out)
 
     assert (
-        internic_content == builtin_content
+        internic_records == builtin_records
     ), "Built-in root hints differ from official named.root"