From: Michal Nowak Date: Tue, 9 Jun 2026 16:11:51 +0000 (+0000) Subject: Check for unregistered rdata files in CI X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11539c7f4af402cc8d7fcdfb4a01e08f6cd25376;p=thirdparty%2Fbind9.git Check for unregistered rdata files in CI Verify in the misc CI job that every rdata source file under lib/dns/rdata is an input of the generated lib/dns/code.h, i.e. registered in dns_header_depfiles. An unregistered file is still compiled into BIND 9 (gen.c scans the directories directly), but editing it does not trigger regeneration of code.h. Assisted-by: Claude:claude-opus-4-8 --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a4ad6a697e..ce1094b9d8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -689,6 +689,9 @@ misc: - sh util/check-gitignore.sh - sh util/check-trailing-whitespace.sh - bash util/unused-headers.sh + # Check that every rdata source file is registered for header generation + - meson setup build + - bash util/check-rdata-registration.sh build # Check dangling symlinks in the repository - if find . -xtype l | grep .; then exit 1; fi - muon-meson analyze -Werror diff --git a/util/check-rdata-registration.sh b/util/check-rdata-registration.sh new file mode 100755 index 0000000000..2048e26e3a --- /dev/null +++ b/util/check-rdata-registration.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# SPDX-License-Identifier: MPL-2.0 +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, you can obtain one at https://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +# Fail if an rdata source file under lib/dns/rdata is not registered as an +# input of the generated lib/dns/code.h header, i.e. missing from +# dns_header_depfiles in the relevant meson.build. An unregistered file is +# still compiled into BIND 9 (gen.c scans the directories directly), but +# editing it does not trigger regeneration of code.h. +# +# Usage: check-rdata-registration.sh [BUILDDIR] (BUILDDIR defaults to "build") + +set -euo pipefail + +builddir=${1:-build} + +registered=$(mktemp) +ondisk=$(mktemp) +trap 'rm -f "$registered" "$ondisk"' EXIT + +# Registered files: the inputs lib/dns/code.h is generated from, reduced to +# repo-relative lib/dns/rdata// paths. +ninja -C "$builddir" -t inputs lib/dns/code.h \ + | sed -n 's@^.*\(lib/dns/rdata/[^/]*/[^/]*\)$@\1@p' \ + | sort -u >"$registered" + +# rdata-type source files on disk (e.g. soa_6.c, nsap-ptr_23.h). Skeleton +# files such as proforma.c are not type-named and are skipped, mirroring +# gen.c's filename filter. +printf '%s\n' lib/dns/rdata/*/*.c lib/dns/rdata/*/*.h \ + | grep -E '/[-0-9a-z]+_[0-9]+\.[ch]$' \ + | sort -u >"$ondisk" + +unregistered=$(comm -23 "$ondisk" "$registered") + +if [ -n "$unregistered" ]; then + echo "$unregistered" | while read -r file; do + echo "Rdata file $file is not registered for header" \ + "generation (add it to dns_header_depfiles in the" \ + "meson.build)" >&2 + done + exit 1 +fi + +exit 0