Skip to content

fix: handle unbound BASH_SOURCE when install.sh is piped via curl#656

Merged
kjw3 merged 1 commit intomainfrom
fix/install-bash-source-piped
Mar 22, 2026
Merged

fix: handle unbound BASH_SOURCE when install.sh is piped via curl#656
kjw3 merged 1 commit intomainfrom
fix/install-bash-source-piped

Conversation

@ericksoa
Copy link
Contributor

@ericksoa ericksoa commented Mar 22, 2026

Summary

curl -fsSL https://www.nvidia.com/nemoclaw.sh | bash fails with BASH_SOURCE[0]: unbound variable because BASH_SOURCE is empty when piped and set -u treats it as unbound.

Fix: ${BASH_SOURCE[0]:-$0} falls back to $0 when BASH_SOURCE is unset.

Regression from #470.

Closes #655

Summary by CodeRabbit

  • Bug Fixes
    • Improved installation script reliability across different shell environments.

@coderabbitai
Copy link

coderabbitai bot commented Mar 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d94ba07d-8466-49b3-9e9b-807245eac440

📥 Commits

Reviewing files that changed from the base of the PR and between 2ce2905 and d76cc4c.

📒 Files selected for processing (1)
  • install.sh

📝 Walkthrough

Walkthrough

The install.sh script now handles the case where BASH_SOURCE[0] is unset or empty by using a fallback to $0. This allows the script to execute correctly when piped via curl | bash without triggering an unbound variable error.

Changes

Cohort / File(s) Summary
Script Directory Resolution
install.sh
Added fallback mechanism to BASH_SOURCE[0]:-$0 to resolve script directory, preventing unbound variable errors when script is piped via curl.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A hop, a skip, a bash variable fix,
When piped through curl, it's all about tricks,
With $0 as backup, we're set to succeed,
This little fallback is all that we need!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: handling an unbound BASH_SOURCE variable when install.sh is piped via curl, which is the core change in this PR.
Linked Issues check ✅ Passed The PR implements the exact fix proposed in issue #655 by using ${BASH_SOURCE[0]:-$0} fallback syntax to resolve SCRIPT_DIR when BASH_SOURCE is unset, directly addressing the regression from PR #470.
Out of Scope Changes check ✅ Passed The change is narrowly scoped to the install.sh script and only modifies the SCRIPT_DIR computation to handle the unbound variable issue, with no unrelated alterations present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/install-bash-source-piped

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

@ericksoa ericksoa requested a review from kjw3 March 22, 2026 18:52
@kjw3 kjw3 merged commit 5eb4b71 into main Mar 22, 2026
7 checks passed
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.

bug: install.sh fails with 'BASH_SOURCE[0]: unbound variable' when piped via curl

3 participants