From 3b59b094af57dbf87fe7174d893a9d5f96f2299e Mon Sep 17 00:00:00 2001 From: Pieter Viljoen Date: Sun, 28 Jun 2026 22:05:04 -0700 Subject: [PATCH] Keep jq stderr in jq_lacks so real errors show a diagnostic Discard only stdout (drop 2>&1); jq's exit 0/1/4 cases produce no stderr so normal runs stay silent, but a real jq error (2/3/5) now prints its message. Converges with the Docker repos. Co-Authored-By: Claude Opus 4.8 (1M context) --- repo-config/configure.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repo-config/configure.sh b/repo-config/configure.sh index 9d6a8ad..d8ca484 100755 --- a/repo-config/configure.sh +++ b/repo-config/configure.sh @@ -89,8 +89,8 @@ jq_has() { jq -e "$@" >/dev/null 2>&1; } # `jq -e` exits 1 (last output false/null) or 4 (no output at all) for the "lacks" cases, 0 for a truthy # match, and 2/3/5 for a real error (malformed filter or input), which is propagated so the calling assert # fails loudly. The `|| rc=$?` keeps jq in a list (exempt from set -e) so a non-zero exit captures rc instead -# of aborting. -jq_lacks() { local rc=0; jq -e "$@" >/dev/null 2>&1 || rc=$?; case "$rc" in 0) return 1 ;; 1|4) return 0 ;; *) return "$rc" ;; esac; } +# of aborting. Only stdout is discarded - jq's stderr is kept so a real error shows its diagnostic. +jq_lacks() { local rc=0; jq -e "$@" >/dev/null || rc=$?; case "$rc" in 0) return 1 ;; 1|4) return 0 ;; *) return "$rc" ;; esac; } check_ruleset() { # name expected-merge-method expect-linear(true/false) local name="$1" method="$2" linear="$3" id rs