Skip to content

Commit c2e7c86

Browse files
committed
fix(hack): avoid a SIGPIPE false-negative in the resourcesPreset check
check-rd-presets.sh tests each expected preset with `printf '%s\n' "$enums" | grep -Fqx -- "$want"`. When grep matches it exits immediately and closes the pipe, so printf is killed by SIGPIPE (exit 141) while it still has data to write. Under `set -o pipefail` that 141 propagates as the pipeline's status, so `if ! <pipeline>` reads a preset that IS present as missing. It is a race with the pipe buffer, so it fires intermittently and mostly on the larger enums -- seen in CI on http-cache-rd, whose schema carries two 47-entry enums -- failing the "Unit & controller tests" job for unrelated PRs. Feed grep from a here-string instead of a pipe: no second process, no SIGPIPE, no pipefail interaction. Deterministic repro of the old behaviour (target at the front of a 100k-line list): the pipe form reports "missing", the here-string form finds it. Signed-off-by: Alexey Artamonov <[email protected]>
1 parent e89617d commit c2e7c86

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎hack/check-rd-presets.sh‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ 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+
# here-string, not a pipe: a `printf ... | grep -q` pipeline SIGPIPEs the
40+
# printf when grep matches early and exits, and under `set -o pipefail` that
41+
# 141 makes the whole pipeline read as failure — a false "missing" for a
42+
# preset that is present (hit on the larger enums, e.g. http-cache-rd).
43+
if ! grep -Fqx -- "$want" <<<"$enums"; then
4044
missing+=("$want")
4145
fi
4246
done

0 commit comments

Comments
 (0)