Skip to content

fix(build): build.sh reports false failure on successful builds - #245

Merged
yoavkatz merged 1 commit into
Exgentic:feature/mcp-commandfrom
vz-ibm:fix/build-sh-count-increment
Aug 11, 2026
Merged

yoavkatz merged 1 commit into
Exgentic:feature/mcp-commandfrom
vz-ibm:fix/build-sh-count-increment

Conversation

@vz-ibm

@vz-ibm vz-ibm commented Aug 5, 2026

Copy link
Copy Markdown

Problem

`((SUCCESS_COUNT++))` with `SUCCESS_COUNT` starting at `0` evaluates to
the pre-increment value (`0`), which bash treats as a failed command
under `set -e` — so the script exits immediately right after a
successful build, before ever printing the build summary, and reports
exit code 1 despite the build having actually succeeded. The same latent
bug applies to `FAIL_COUNT` on the first real failure (it would exit
before `print_error` even runs).

Found while building `exgentic-mcp-tau2` for a downstream integration —
`./build.sh tau2` printed `[INFO] ✓ Successfully built
localhost/exgentic-mcp-tau2:latest` and then exited 1 with no error
message. Confirmed the image genuinely built fine (`podman images`
showed it).

Fix

Switched both counters to plain arithmetic assignment (`$((x + 1))`),
which has no such trap — only a bare `((expr))` command's own exit
status is subject to this, not an assignment.

Base is `feature/mcp-command` (this script only exists there, not on
`main` yet) so this is easy to review/merge independently of the larger
`#187`.

((SUCCESS_COUNT++)) with SUCCESS_COUNT starting at 0 evaluates to the
pre-increment value (0), which bash treats as a failed command under
`set -e` -- so the script exits immediately right after a successful
build, before ever printing the build summary, and reports exit code 1
despite the build having actually succeeded. Same latent bug applies to
FAIL_COUNT on the first real failure. Switched both to plain arithmetic
assignment ($((x + 1))), which has no such trap.

Found while building exgentic-mcp-tau2 for a downstream integration --
the image built fine (confirmed via `podman images`) but the script
reported failure with no error message, right after printing
"Successfully built ...".

Signed-off-by: Vitaly Zabershinsky <VITALYZ@il.ibm.com>
@vz-ibm
vz-ibm force-pushed the fix/build-sh-count-increment branch from 3e34f66 to 74ae6e7 Compare August 11, 2026 13:20
@yoavkatz
yoavkatz merged commit 52987d4 into Exgentic:feature/mcp-command Aug 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants