Skip to content

bug: Bash 4.x regex in provision.sh breaks macOS bash 3.2 compatibility #3071

@louisgv

Description

@louisgv

Summary

sh/e2e/lib/provision.sh uses bash 4.x [[ regex matching which is incompatible with macOS bash 3.2, violating the project's shell compatibility requirements documented in CLAUDE.md.

Location

  • File: sh/e2e/lib/provision.sh
  • Line: 60

Issue Details

The code uses bash 4.x extended regex matching:

if [[ "${_env_line}" =~ ^export[[:space:]]+([A-Za-z_][A-Za-z0-9_]*)=\"(.*)\"$ ]]; then
  export "${BASH_REMATCH[1]}"="${BASH_REMATCH[2]}"
fi

According to CLAUDE.md:

macOS bash 3.x Compatibility
macOS ships bash 3.2. All scripts MUST work on it.

Impact

  • Script will fail on macOS with bash 3.2
  • Breaks the E2E test harness on macOS systems
  • Violates documented compatibility requirements

Recommendation

Use POSIX-compatible pattern matching or case statement with glob patterns instead of [[ =~ ]].

Example fix:

case "${_env_line}" in
  export\ *=\"*\")
    # Extract variable name and value using sed/awk
    ;;
esac

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    in-progressIssue is being actively worked onsafe-to-workSecurity triage: safe for automated processing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions