From 2cf83f5922f8d843a3e92f694100c772b4d86930 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 22 Nov 2026 06:53:20 -0800 Subject: [PATCH] ci: public-text check self-test: a failing grep refuses Co-Authored-By: Claude Fable 5.2 --- seaweed-block/.github/scripts/public-text-check-test.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/seaweed-block/.github/scripts/public-text-check-test.sh b/seaweed-block/.github/scripts/public-text-check-test.sh index 964c440636..a59dc7e096 100755 --- a/seaweed-block/.github/scripts/public-text-check-test.sh +++ b/seaweed-block/.github/scripts/public-text-check-test.sh @@ -41,4 +41,11 @@ expect 1 "backslash form of the share path in the title" "$mb2" HEAD title body; expect 2 "a missing title file is an error, not clean" "$mb2" HEAD no-such-title body expect 2 "a missing description file is an error, not clean" "$mb2" HEAD title no-such-body expect 2 "an unknown commit is an error, not clean" 0000000000000000000000000000000000000000 HEAD title body +# A grep that fails (exit 2) is an error: the check must refuse and never print "clean". +mkdir -p fakebin; printf '#!/bin/sh +exit 2 +' > fakebin/grep; chmod +x fakebin/grep +rc=0; PATH="$PWD/fakebin:$PATH" bash "$here/public-text-check.sh" "$mb2" HEAD title body >out 2>&1 || rc=$? +[ "$rc" = 2 ] || { echo "public-text-check-test: failing grep: exit $rc, want 2"; cat out; exit 1; } +if PATH=/usr/bin:/bin grep -q "clean" out; then echo "public-text-check-test: failing grep printed clean"; cat out; exit 1; fi echo "public-text-check-test: ok"