Skip to content

fix: handle empty EXTRA_ARGS array in bash 3.2 (macOS default)#289

Open
gandalf-at-lerian wants to merge 1 commit intomainfrom
fix/enforce-fiber-framework
Open

fix: handle empty EXTRA_ARGS array in bash 3.2 (macOS default)#289
gandalf-at-lerian wants to merge 1 commit intomainfrom
fix/enforce-fiber-framework

Conversation

@gandalf-at-lerian
Copy link
Contributor

Problem

On macOS, the default bash is 3.2. With set -u (unbound variable protection), expanding an empty array "${EXTRA_ARGS[@]}" throws:

./installer/install-ring.sh: line 198: EXTRA_ARGS[@]: unbound variable

This happens whenever the user answers N to all three optional prompts (symlink, verbose, dry-run), leaving EXTRA_ARGS as an empty array.

Fix

Use the conditional expansion form ${arr[@]+"${arr[@]}"} — expands to nothing when the array is empty, fully compatible with bash 3.2+.

Reported by

Garzão via #the-ring-feedbacks

set -u with empty arrays throws 'unbound variable' on bash < 4.4.
Use the conditional expansion form ${arr[@]+"${arr[@]}"} which
expands to nothing when the array is empty, compatible with all bash versions.

Fixes: https://github.com/LerianStudio/ring/issues (reported by Garzão)
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4d92196c-b424-4573-be7f-51a2c1f8bcf1

📥 Commits

Reviewing files that changed from the base of the PR and between 3014953 and 386be77.

📒 Files selected for processing (1)
  • installer/install-ring.sh

Walkthrough

The installation script installer/install-ring.sh was modified to improve the handling of the EXTRA_ARGS variable when passing arguments to the Python installer module. The expansion syntax was changed from ${EXTRA_ARGS[@]} to ${EXTRA_ARGS[@]+"${EXTRA_ARGS[@]}"} in both the dry-run and actual installation command paths. This syntax ensures that when EXTRA_ARGS is empty or unset, the argument is not expanded as an empty parameter, preventing potential issues with how the arguments are passed to python -m installer.ring_installer.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: handle empty EXTRA_ARGS array in bash 3.2 (macOS default)' directly and specifically describes the main change: fixing handling of empty arrays in bash 3.2.
Description check ✅ Passed The description clearly explains the problem (unbound variable error with empty arrays in bash 3.2), the specific fix (using conditional expansion), and provides context about when it occurs.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant