Skip to content

Conversation

@bussyjd
Copy link
Collaborator

@bussyjd bussyjd commented Sep 10, 2025

Summary

  • Fixed compatibility issues with macOS's default bash 3.2 by removing bash 4+ specific features
  • Script now works on all macOS systems without requiring bash upgrade

Changes

  1. Removed associative arrays (bash 4.0+ feature):

    • Replaced SUPPORTED_NETWORKS associative array with get_chain_id() function
    • Replaced SUPPORTED_MODES associative array with is_valid_mode() function
    • Used case statements for compatibility with bash 3.x
  2. Removed nameref variables (bash 4.3+ feature):

    • Replaced declare -n with standard variable passing
    • Updated validation functions to return values via echo
    • Modified function calls to capture return values using command substitution
  3. Fixed log output interference:

    • Redirected all log messages to stderr to prevent them from being captured in function return values
    • This ensures clean separation between logging and functional output

Testing

  • Tested with bash 3.2.57 on macOS
  • All functionality preserved while maintaining backward compatibility
  • Script now works out-of-the-box on macOS without requiring bash upgrade

Context

macOS ships with bash 3.2 due to licensing (last GPL v2 version), so many users encounter issues with scripts using bash 4+ features. This fix ensures the obolup script works for all macOS users without additional setup.

Copy link
Contributor

@OisinKyne OisinKyne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine, but could we merge my sepolia PR and then update this to also support sepolia before merging? :)

Signed-off-by: JeanDaniel Bussy <jd@obol.tech>
@bussyjd bussyjd merged commit ea9730d into main Sep 10, 2025
1 check passed
@bussyjd bussyjd deleted the fix/obolup branch September 10, 2025 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants