From ed9501235bc8e0ba3b5afaa97b6dc8ab0c08e64b Mon Sep 17 00:00:00 2001 From: A <258483684+la14-1@users.noreply.github.com> Date: Sat, 21 Feb 2026 07:49:17 -0800 Subject: [PATCH] =?UTF-8?q?fix:=20bash=203.2=20compat=20=E2=80=94=20sed=20?= =?UTF-8?q?for=20pattern=20sub=20+=20split=20local=20var=3D$(cmd)=20(#1572?= =?UTF-8?q?,=20#1571)=20(#1587)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue #1572: Replace bash 4+ ${//} pattern substitution in generate_env_config with sed for macOS bash 3.2 compatibility. Issue #1571: Split local var=$(cmd) declarations in fly/lib/common.sh so exit codes propagate correctly with set -e on macOS bash 3.2. Agent: code-health Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 --- fly/lib/common.sh | 6 ++++-- shared/common.sh | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fly/lib/common.sh b/fly/lib/common.sh index 40b8e794..21d0b91f 100644 --- a/fly/lib/common.sh +++ b/fly/lib/common.sh @@ -685,8 +685,10 @@ except Exception: # List all Fly.io apps and machines list_servers() { - local org=$(get_fly_org) - local response=$(fly_api GET "/apps?org_slug=$org") + local org + org=$(get_fly_org) + local response + response=$(fly_api GET "/apps?org_slug=$org") printf '%s' "$response" | python3 -c " import json, sys diff --git a/shared/common.sh b/shared/common.sh index e0eb92a6..a5d002b6 100644 --- a/shared/common.sh +++ b/shared/common.sh @@ -1278,7 +1278,9 @@ generate_env_config() { fi # Escape any single quotes in the value: replace ' with '\'' - local escaped_value="${value//\'/\'\\\'\'}" + # Use sed instead of ${//} pattern substitution for bash 3.2 (macOS) compat + local escaped_value + escaped_value=$(printf '%s' "$value" | sed "s/'/'\\\\''/g") echo "export ${key}='${escaped_value}'" done }