From 2e1f933d659561966dc7876356bf3a63b5b797a2 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 30 May 2025 13:03:16 +1000 Subject: [PATCH 1/2] Extend named-rrchecker multi-line parsing support named-rrchecker now parses the braces which support multi-line input from the beginning of the input rather than only when reading the data fields of the record. --- bin/tools/named-rrchecker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/tools/named-rrchecker.c b/bin/tools/named-rrchecker.c index 71023bb926..be7a14016e 100644 --- a/bin/tools/named-rrchecker.c +++ b/bin/tools/named-rrchecker.c @@ -181,7 +181,7 @@ main(int argc, char *argv[]) { specials[')'] = 1; specials['"'] = 1; isc_lex_setspecials(lex, specials); - options = ISC_LEXOPT_EOL; + options = ISC_LEXOPT_EOL | ISC_LEXOPT_DNSMULTILINE; isc_lex_setcomments(lex, ISC_LEXCOMMENT_DNSMASTERFILE); isc_lex_openstream(lex, stdin); From 5f882f95fe5308cd43d0da49d40d938351634189 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 2 Jun 2025 14:37:45 +1000 Subject: [PATCH 2/2] Add various multi-line inputs to named-rrchecker --- bin/tests/system/rrchecker/tests_rrchecker.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bin/tests/system/rrchecker/tests_rrchecker.py b/bin/tests/system/rrchecker/tests_rrchecker.py index e7883539b0..bbe578f98b 100644 --- a/bin/tests/system/rrchecker/tests_rrchecker.py +++ b/bin/tests/system/rrchecker/tests_rrchecker.py @@ -136,7 +136,10 @@ def run_rrchecker(option, rr_class, rr_type, rr_rest): return rrchecker_output.split() -@pytest.mark.parametrize("option", ["-p", "-u"]) +@pytest.mark.parametrize( + "option", + ["-p", "-u", "multi-line at class", " multi-line at type", "multi-line at data"], +) def test_rrchecker_conversions(option): tempzone_file = "tempzone" with open(tempzone_file, "w", encoding="utf-8") as file: @@ -175,6 +178,15 @@ def test_rrchecker_conversions(option): "-u", rr_class_orig, rr_type_orig, rr_rest_orig ) rr_rest = " ".join(rr_rest) + elif option == "multi-line at class": + rr_class = "(" + rr_class + rr_rest = rr_rest + ")" + elif option == "multi-line at type": + rr_type = "(" + rr_type + rr_rest = rr_rest + ")" + elif option == "multi-line at data": + rr_rest = "(" + rr_rest + rr_rest = rr_rest + ")" rr_class, rr_type, *rr_rest = run_rrchecker("-p", rr_class, rr_type, rr_rest)