Skip to content

El instalador moría en todos los Mac - #22

Merged
borjaperfra merged 1 commit into
mainfrom
fix/bash32-mac
Sep 14, 2026
Merged

borjaperfra merged 1 commit into
mainfrom
fix/bash32-mac

Conversation

@borjaperfra

@borjaperfra borjaperfra commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Reported from macOS:

‣ fetching latest release...
bash: line 64: auth[@]: unbound variable
✗ could not work out the latest version from the GitHub API
✗ it rate limits unauthenticated requests, so this is usually temporary

The bug

The token support added yesterday built the curl arguments in an array and expanded it as "${auth[@]}". macOS ships bash 3.2.57 at /bin/bash, frozen in 2007 by its licence, and there that expansion over an empty array under set -u is an unbound variable. Fixed in bash 4.4 — which no Mac has.

So not an edge case: every Mac without a token. And then the script blamed the GitHub rate limit for a bug of its own — the worst kind of error message, confident and pointing the wrong way. That wording is softened too: it says the usual cause rather than asserting one.

Two branches and no array now.

Why CI missed it, which is the more useful half

Not the shell. The first draft of this explanation guessed a Homebrew bash 5 was shadowing /bin/bash on the runner; the log says both are 3.2.57, so that was wrong.

The real reason: the installer job sets GITHUB_TOKEN, so the array was never empty in any path that installs something. The one step that empties it — the one checking that a failed version lookup explains itself — asserted only that the output contained could not work out the latest version.

The bug produced exactly that message. The assertion was satisfied by the failure it existed to tell apart, and passed for a whole release while the script was dying two lines earlier.

That check now also refuses any output carrying a shell error — unbound variable, command not found, syntax error, bad substitution — which is never the expected path whatever text follows it. Verified against the reverted bug before going in.

And every invocation is /bin/bash with both versions printed, so which shell ran is a fact on the log rather than an assumption.

Version goes to 0.1.19.

Reported from macOS:

    ‣ fetching latest release...
    bash: line 64: auth[@]: unbound variable
    ✗ could not work out the latest version from the GitHub API

The token support added yesterday built the curl arguments in an array and
expanded it as "${auth[@]}". macOS ships bash 3.2.57 at /bin/bash, frozen in
2007 by its licence, and there that expansion over an EMPTY array under
`set -u` is an unbound variable. It was fixed in bash 4.4, which no Mac has.

So not an edge case: every Mac without a token. And then the script blamed the
GitHub rate limit for a bug of its own, which is the worst kind of error
message - confident and pointing the wrong way. That wording is softened too;
it says the usual cause rather than asserting one.

Two branches and no array now.

Why CI did not catch it is the more useful half, and it was not the shell. The
installer job sets GITHUB_TOKEN, so the array was never empty in the paths that
install anything. The one step that empties it - the one checking that a failed
version lookup explains itself - asserted only that the output contained "could
not work out the latest version". The bug produced exactly that message. The
assertion was satisfied by the failure it existed to tell apart, and passed for
a whole release while the script was broken two lines earlier.

That check now also refuses any output carrying a shell error, which is never
the expected path whatever text follows it. And every invocation is /bin/bash
with both versions printed, so which shell ran is a fact on the log rather than
an assumption - the first draft of this message guessed Homebrew's bash 5 was
shadowing it, and the log said otherwise.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@borjaperfra
borjaperfra merged commit 5cf6d22 into main Sep 14, 2026
4 checks passed
@borjaperfra
borjaperfra deleted the fix/bash32-mac branch September 14, 2026 16:05
borjaperfra added a commit to helmcode/nan that referenced this pull request Sep 14, 2026
v0.1.18 and v0.1.17 died on every Mac without a GITHUB_TOKEN: the version
lookup expanded an empty array under `set -u`, which is an unbound variable in
the bash 3.2 macOS ships. helmcode/nan-cli#22.

Co-authored-by: borjaperfra <borjaperfra@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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