fix: use awk instead of grep -Eo in smoke test for Alpine compatibility (#296)

busybox grep on Alpine handles ERE character classes [(][)] differently
from GNU grep, causing get_fns to miss function definitions like
handle_ci_exhaustion(). awk is portable and works identically on all
platforms.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-19 19:43:42 +00:00
parent 809dd93c3b
commit 268ddc398c

View file

@ -18,10 +18,14 @@ FAILED=0
# ── helpers ─────────────────────────────────────────────────────────────────
# Extract function names defined in a bash script (top-level or indented).
# Uses awk instead of grep -Eo for busybox/Alpine compatibility (#296).
get_fns() {
local f="$1"
grep -Eo '[a-zA-Z_][a-zA-Z0-9_]+[[:space:]]*[(][)]' "$f" 2>/dev/null \
| sed 's/[[:space:]]*()//' | sort -u || true
awk '/^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]+[[:space:]]*\(\)/ {
sub(/^[[:space:]]+/, "")
sub(/[[:space:]]*\(\).*/, "")
print
}' "$f" 2>/dev/null | sort -u || true
}
# Extract call-position identifiers that look like custom function calls: