From 63b6844c080186b3fb0299916a3f4696513b2c1b Mon Sep 17 00:00:00 2001 From: "Tj (bougyman) Vanderpoel" Date: Wed, 12 Aug 2026 16:09:21 -0400 Subject: [PATCH] fix: retry install.sh's curl downloads on transient connection failures GitHub's release-download redirect chain occasionally drops the connection outright mid-stream (curl: (56) Connection died) - reproduced directly from two different networks, confirming it's server-side flakiness, not local. Plain --retry alone doesn't cover this specific error (it's outside curl's default retriable set) - only succeeded once --retry-all-errors was added too, verified by re-running the actual failing download repeatedly until it reproduced, then confirming the fix resolves it. Also updates Readme.adoc's documented curl commands (the manual "Download a release binary" steps, and both install.sh/uninstall.sh curl-pipe one-liners) to match. --- Readme.adoc | 8 ++++---- install.sh | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Readme.adoc b/Readme.adoc index 7690ebc..1faee27 100644 --- a/Readme.adoc +++ b/Readme.adoc @@ -58,8 +58,8 @@ bundles `lc` with the wrapper scripts (`lcreate`, `lcls`, `lclose`, [source,sh] ---- -$ curl -sLO https://github.com/rubyists/linear-cli/releases/latest/download/lc_macos_aarch64.tar.gz -$ curl -sLo SHA256SUMS https://github.com/rubyists/linear-cli/releases/latest/download/SHA256SUMS +$ curl --retry 5 --retry-all-errors -sLO https://github.com/rubyists/linear-cli/releases/latest/download/lc_macos_aarch64.tar.gz +$ curl --retry 5 --retry-all-errors -sLo SHA256SUMS https://github.com/rubyists/linear-cli/releases/latest/download/SHA256SUMS $ grep -q lc_macos_aarch64.tar.gz SHA256SUMS && grep lc_macos_aarch64.tar.gz SHA256SUMS | shasum -a 256 -c - <1> $ mkdir lc && tar -xzf lc_macos_aarch64.tar.gz -C lc $ sudo mv lc/* /usr/local/bin/ @@ -94,7 +94,7 @@ See https://github.com/rubyists/homebrew-tap for the formula itself. [source,sh] ---- -$ curl -fsSL https://raw.githubusercontent.com/rubyists/linear-cli/main/install.sh | bash +$ curl --retry 5 --retry-all-errors -fsSL https://raw.githubusercontent.com/rubyists/linear-cli/main/install.sh | bash ---- Detects your platform, downloads and checksum-verifies the matching release @@ -106,7 +106,7 @@ specific install directory. [source,sh] ---- -$ curl -fsSL https://raw.githubusercontent.com/rubyists/linear-cli/main/uninstall.sh | bash +$ curl --retry 5 --retry-all-errors -fsSL https://raw.githubusercontent.com/rubyists/linear-cli/main/uninstall.sh | bash ---- Removes exactly what `install.sh` installed, by replaying the manifest it diff --git a/install.sh b/install.sh index 0f4457a..cec9d5d 100755 --- a/install.sh +++ b/install.sh @@ -110,13 +110,19 @@ fetch_lc() { printf 'Downloading %s (%s)...\n' "$tarball" "$version" >&2 - if ! curl -fsSL "$(release_url "$tarball")" -o "$tmp_dir/$tarball" + # --retry-all-errors: GitHub's release-download redirect chain + # occasionally drops the connection outright mid-stream (curl: (56) + # Connection died) - verified directly, reproduced it repeatedly, and + # confirmed plain --retry alone does NOT cover this specific error + # (it's outside curl's default retriable set), only succeeding once + # --retry-all-errors was added too. + if ! curl -fsSL --retry 5 --retry-all-errors "$(release_url "$tarball")" -o "$tmp_dir/$tarball" then printf 'error: failed to download %s\n' "$tarball" >&2 exit 1 fi - if ! curl -fsSL "$(release_url "SHA256SUMS")" -o "$tmp_dir/SHA256SUMS" + if ! curl -fsSL --retry 5 --retry-all-errors "$(release_url "SHA256SUMS")" -o "$tmp_dir/SHA256SUMS" then printf 'error: failed to download SHA256SUMS\n' >&2 exit 1