-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Description
Fix sed -r → sed -E for macOS compatibility in update-estimator-protobuf.sh
Part of #7269
Problem
Line 47 of hack/update-estimator-protobuf.sh uses sed -r to extract the protoc major version:
if [[ -z "$(which protoc)" || $(protoc --version | sed -r "s/libprotoc ([0-9]+).*/\1/g") -lt 3 ]];-r is a GNU sed flag and is not recognized by BSD sed, which ships with macOS. Running this script on macOS produces:
sed: illegal option -- r
Since this is inside an if condition at the very start of the script, it aborts immediately — before even checking if protoc is installed.
Fix
Replace -r with -E. The regex pattern itself is unchanged.
# Before (GNU sed only)
protoc --version | sed -r "s/libprotoc ([0-9]+).*/\1/g"
# After (BSD + GNU sed)
protoc --version | sed -E "s/libprotoc ([0-9]+).*/\1/g"-E is the POSIX standard flag for extended regex and is supported by both BSD sed (macOS) and GNU sed (Linux, since 4.2 / 2012).
Testing
Verified on macOS (Apple Silicon) — script no longer aborts with illegal option error.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Type
Projects
Status
No status