El instalador moría en todos los Mac - #22
Merged
Merged
Conversation
borjaperfra
force-pushed
the
fix/bash32-mac
branch
from
September 14, 2026 16:04
a3048ce to
d6d552d
Compare
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
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reported from macOS:
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 underset -uis 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/bashon 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 containedcould 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/bashwith both versions printed, so which shell ran is a fact on the log rather than an assumption.Version goes to 0.1.19.