Skip to content

Fix SIGPIPE race in go.mod Go-version parsing - #10

Merged
lionello merged 1 commit into
mainfrom
fix/gomod-curl-sigpipe
Sep 4, 2026
Merged

lionello merged 1 commit into
mainfrom
fix/gomod-curl-sigpipe

Conversation

@defangdevs

Copy link
Copy Markdown
Contributor

Summary

  • The "Update Homebrew Formula" workflow started failing on run 32432417340 (and again on rerun) at the "Determine required Go version from go.mod" step, with curl exiting 23 ("failed writing received data").
  • Root cause: curl -fsSL "$GO_MOD_URL" | awk '/^go [0-9]/{print $2; exit}' — the go X.Y line sits near the top of go.mod, so awk matches almost immediately and its exit closes the pipe's read end while curl may still be writing the rest of the (now larger, dependency-heavy) response body. That's a SIGPIPE race: curl gets a write error and returns 23, which set -o pipefail turns into a step failure. This explains why it worked for months and only recently started failing — go.mod grew enough that curl now issues multiple writes, widening the race window.
  • Fix: capture curl's full output into a variable first, then run awk over it. This removes the pipe entirely so parsing never races the download.

Test plan

  • Ran the fixed snippet locally against the real URL (v3.14.0/src/go.mod) — correctly resolves GO_FULL=1.25.9.
  • Confirm the workflow succeeds end-to-end on a real repository_dispatch (or manual workflow_dispatch) run after merge.

🤖 Generated with Claude Code

curl was piped directly into awk '{... exit}'. Once awk matches the
"go X.Y" line (near the top of go.mod) it exits immediately, closing
the pipe's read end while curl may still be writing the rest of the
response body. That races curl into a SIGPIPE and exit code 23 under
pipefail. Capture curl's output into a variable first, then parse it
with awk, so the download always completes before parsing starts.
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4033e2c1-8bdb-43ad-9868-68940bb8c298


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@defangdevs

Copy link
Copy Markdown
Contributor Author

Note: because both automatic attempts for v3.14.0 failed (this bug), the formula is still pinned to v3.13.0 / go@1.24. workflow_dispatch fetches the latest release regardless of trigger, so after merging this fix, please run the workflow manually once (Actions → Update Homebrew Formula → Run workflow) to pick up v3.14.0 — it won't retry on its own since the repository_dispatch event already fired.

@lionello
lionello merged commit 897d6ea into main Sep 4, 2026
8 checks passed
@lionello
lionello deleted the fix/gomod-curl-sigpipe branch September 4, 2026 23:55
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