fix: agent-smoke: use [(][)] for literal parens in BRE regex
Some BusyBox grep builds treat bare () as grouping operators even in BRE mode, causing get_fns to miss function definitions like ci_commit_status. Using [(][)] is unambiguous across all grep implementations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1a72ddc1bd
commit
fb44a9b248
1 changed files with 5 additions and 4 deletions
|
|
@ -21,10 +21,11 @@ FAILED=0
|
|||
# Uses awk instead of grep -Eo for busybox/Alpine compatibility (#296).
|
||||
get_fns() {
|
||||
local f="$1"
|
||||
# BRE mode (no -E): () is literal in BRE, avoiding BusyBox ERE bugs
|
||||
# where \(\) is misinterpreted. BRE one-or-more via [X][X]* instead of +.
|
||||
grep '^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_][a-zA-Z0-9_]*[[:space:]]*()' "$f" 2>/dev/null \
|
||||
| sed 's/^[[:space:]]*//; s/[[:space:]]*().*$//' \
|
||||
# BRE mode (no -E). Use [(][)] for literal parens — unambiguous across
|
||||
# GNU grep and BusyBox grep (some BusyBox builds treat bare () as grouping
|
||||
# even in BRE). BRE one-or-more via [X][X]* instead of +.
|
||||
grep '^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_][a-zA-Z0-9_]*[[:space:]]*[(][)]' "$f" 2>/dev/null \
|
||||
| sed 's/^[[:space:]]*//; s/[[:space:]]*[(][)].*$//' \
|
||||
| sort -u || true
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue