From 6150be8a22a4ca000f36a2b8018c079c5f59657a Mon Sep 17 00:00:00 2001 From: igneum-josh <337424239+igneum-josh@users.noreply.github.com> Date: Thu, 8 Oct 2026 09:44:32 +0100 Subject: [PATCH] Site deploy checks: grep -c in place of grep -q on every piped read (grep -q exits on the first match and the writer fails under pipefail) Co-Authored-By: Claude Fable 5.1 --- tools/site-deploy-from-mirror.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/site-deploy-from-mirror.sh b/tools/site-deploy-from-mirror.sh index 955c5eefe..333348117 100755 --- a/tools/site-deploy-from-mirror.sh +++ b/tools/site-deploy-from-mirror.sh @@ -32,11 +32,11 @@ post_checks() { # one pass: prints the first mismatch as "field: detail" and ret n=$(printf '%s' "$j" | python3 -c 'import sys,json; print(json.load(sys.stdin)["state"]["network"])' 2>/dev/null || echo "?") [ "$n" = "$LIVE_NETWORK" ] || { echo "api/live network: $n (want $LIVE_NETWORK)"; return 1; } idx=$(curl -fsS "${nc[@]}" --max-time 20 "$SITE/?x=$RANDOM" 2>/dev/null) || { echo "index: not reachable"; return 1; } - for m in "${INDEX_STRINGS[@]}"; do printf '%s' "$idx" | /usr/bin/grep -qF -- "$m" || { echo "index string missing: \"$m\""; return 1; }; done + for m in "${INDEX_STRINGS[@]}"; do printf '%s' "$idx" | /usr/bin/grep -cF -- "$m" >/dev/null || { echo "index string missing: \"$m\""; return 1; }; done # the page is read into a variable first: `curl | grep -q` under pipefail reads false on a MATCH (grep closes the pipe, curl exits 56; # three false DEPLOY REDs on 7 and 8 October 2026) local legal; legal=$(curl -fsS "${nc[@]}" --max-time 20 "$SITE$LEGAL_PAGE?x=$RANDOM" 2>/dev/null) || { echo "$LEGAL_PAGE: not reachable"; return 1; } - printf '%s' "$legal" | /usr/bin/grep -qiF -- "$LEGAL_STRING" || { echo "legal string missing on $LEGAL_PAGE: \"$LEGAL_STRING\""; return 1; } + printf '%s' "$legal" | /usr/bin/grep -ciF -- "$LEGAL_STRING" >/dev/null || { echo "legal string missing on $LEGAL_PAGE: \"$LEGAL_STRING\""; return 1; } local miners; miners=$(curl -fsS "${nc[@]}" --max-time 20 "$SITE/miners?x=$RANDOM" 2>/dev/null) || { echo "miners: not reachable"; return 1; } rows=$(miners_rows "$miners") [ "${rows:-0}" -ge "$MINERS_MIN_ROWS" ] || { echo "miners rows: ${rows:-0} (want at least $MINERS_MIN_ROWS)"; return 1; }