fix(rustfs-mirror): the minio/mc image has no grep, so count in the shell #486

Merged
binjovi-bot merged 1 commit from sean/mirror-no-grep into trunk 2026-09-09 14:33:03 +00:00 AGit
Owner

The diff gate counted with grep -c and the minio/mc image has no grep, sed or awk. The command substitution yielded an empty string instead of a number, set -eu could not catch it because the failure was inside $(... || true), and the Job ran all five passes reporting blanks where the counts belong. Counting is now case and arithmetic in a read loop -- no binary to be missing -- and the guard refuses any of the seven absent tools. Five controls, each confirmed red. https://claude.ai/code/session_01KZoQin34jeyt6nDGqvJA76

The diff gate counted with grep -c and the minio/mc image has no grep, sed or awk. The command substitution yielded an empty string instead of a number, set -eu could not catch it because the failure was inside $(... || true), and the Job ran all five passes reporting blanks where the counts belong. Counting is now case and arithmetic in a read loop -- no binary to be missing -- and the guard refuses any of the seven absent tools. Five controls, each confirmed red. https://claude.ai/code/session_01KZoQin34jeyt6nDGqvJA76
fix(rustfs-mirror): the minio/mc image has no grep, so count in the shell
All checks were successful
binjovi/ci Binjovi completed the frozen plan
69ca2749c8
The directional diff gate counted with `grep -c`. The minio/mc image has no
grep. `command -v grep` fails in it, and so do sed and awk.

WHY THAT WAS WORSE THAN A CRASH.

The counts were taken as `missing=$(grep -c '^<' /tmp/diff.out || true)`. The
shell wrote "grep: command not found" to stderr and the command substitution
yielded an EMPTY STRING rather than a number. Every later comparison was
against "", so the loop ran all five passes, printed
"platform-loki-chunks:  missing,  differing" with two blanks where the numbers
belong, and exited claiming a real difference it had never measured.

`set -eu` cannot catch this. The failure is inside `$(... || true)`, which is
exactly the construction used to stop a zero count from killing the script.

Counting is now `case` and `$((...))` in a `while read` loop: no binary at all,
so nothing can be missing. The offending-line excerpt is printed the same way.

THE GUARD NOW REFUSES A TOOL THE IMAGE DOES NOT HAVE.

grep, sed, awk, jq, python3, xargs and find are all absent; wc, head, cat, tr,
cut and sort are present, measured in the image rather than assumed. Matching
and counting belong in the shell.

Five negative controls, each confirmed red on its own: the missing-object
counter removed, the differing-object counter removed, and a call to grep or to
sed introduced anywhere in a mirror script.

Claude-Session: https://claude.ai/code/session_01KZoQin34jeyt6nDGqvJA76
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sean/seanfarm!486
No description provided.