Skip to content

Commit 99d16a2

Browse files
committed
fix(hack): stop the RD preset check failing at random
grep -q exits on its first match, so piping the candidate list into it leaves the writer with unwritten output and kills it with SIGPIPE. Under pipefail the pipeline then exits 141, which the caller reads exactly like "not found" — so a preset that is present gets reported missing, naming a different file and a different preset on every run. Measured at roughly one spurious failure per run before the change, none after. A here-string removes the pipe and with it the race. Assisted-by: LLM Signed-off-by: Andrei Kvapil <[email protected]>
1 parent d21feae commit 99d16a2

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎hack/check-rd-presets.sh‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ for f in packages/system/*-rd/cozyrds/*.yaml; do
3636
missing=()
3737
for want in "${EXPECTED[@]}"; do
3838
# -F: literal match so the `.` in t1.nano does not match any character.
39-
if ! printf '%s\n' "$enums" | grep -Fqx -- "$want"; then
39+
# A here-string, not a pipe: `grep -q` exits on its first match, so a pipe
40+
# leaves the writer with unwritten output and kills it with SIGPIPE. Under
41+
# `set -o pipefail` that becomes exit 141 for the whole pipeline, which
42+
# reads exactly like "not found" — so a preset that IS present is reported
43+
# missing, on a different file and a different preset each run. Measured at
44+
# roughly one spurious failure per run of this script.
45+
if ! grep -Fqx -- "$want" <<<"$enums"; then
4046
missing+=("$want")
4147
fi
4248
done

0 commit comments

Comments
 (0)