Fix examples/gateway/aws/setup.sh aborting on stock macOS bash 3.2 - #82320
Open
Yyunozor wants to merge 1 commit into
Open
Fix examples/gateway/aws/setup.sh aborting on stock macOS bash 3.2#82320Yyunozor wants to merge 1 commit into
Yyunozor wants to merge 1 commit into
Conversation
${DIST_SHA256,,} is a bash 4 case-modification expansion. macOS ships bash
3.2 as /bin/bash, so the line aborts the script with "bad substitution"
before it reaches its own argument checks. Replace it with printf | tr,
pinned to LC_ALL=C so BSD tr cannot fail the script on a stray non-UTF-8
byte under set -e.
This was referenced Jul 29, 2026
5 tasks
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.
setup.shline 66 uses${DIST_SHA256,,}, a bash 4 case-modificationexpansion. macOS ships bash 3.2 as
/bin/bash, so unless a newer bash isearlier on
PATH,#!/usr/bin/env bashresolves to 3.2 and the script abortsthere — before reaching its own argument checks. The line is unconditional, so
it fires whether or not
DIST_URL/DIST_SHA256are set.bash -npasses; thefailure is runtime-only.
From the repo root on stock macOS:
The replacement lowercases the same digests with
tr, pinned toLC_ALL=CsoBSD
trcannot fail the script on a stray non-UTF-8 byte underset -e. Withit, the same bash 3.2 run reaches the normal path and prints
ERROR: AWS_REGION is not set.The comment moves above the line to keep theblock's comment column.
This is the only bash 4 construct I found in the file; the GCP example next
door has none. Portability is already an explicit concern here — see the
sha_of()comment on line 127.