Skip to content

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

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

kjw3 merged 1 commit into
mainfrom
fix/install-bash-source-piped

Conversation

@ericksoa

@ericksoa ericksoa commented Mar 22, 2026 •

Copy link
Copy Markdown
Member

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

coderabbitai Bot commented Mar 22, 2026 •

Copy link
Copy Markdown
Contributor

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
craigamcw pushed a commit to craigamcw/NemoClaw that referenced this pull request Mar 22, 2026
Ryuketsukami pushed a commit to Ryuketsukami/NemoClaw that referenced this pull request Mar 24, 2026
jessesanford pushed a commit to jessesanford/NemoClaw that referenced this pull request Mar 24, 2026
@wscurran wscurran added the bug-fix PR fixes a bug or regression label Jun 8, 2026
@cv
cv deleted the fix/install-bash-source-piped branch June 28, 2026 00:21
cv added a commit that referenced this pull request Nov 20, 2026
Pins Fabric to its
[`v0.7.0`](https://github.com/NVIDIA/NeMo-Fabric/tree/v0.7.0) release
tag, commit `76bde16c`, instead of a commit on its `release/0.7` branch.
Agent images, the SDK and the providers build the released Fabric
without patches, and the agent limits are checked against it.

## Problem

v1 pinned Fabric `c6d1093d`, a commit on NVIDIA/NeMo-Fabric's
`release/0.7` branch, because no Fabric release had the fixes NemoClaw
needs. Fabric has now tagged `v0.7.0`.

Resolves #13318.

## Change

- **Pin:** Fabric `76bde16c40747062001bd6ea5f5d13cadab3d706`, the commit
the `v0.7.0` tag names, in `versions.json` (with the archive's SHA-256),
the Cargo manifests and `Cargo.lock`. The pin stays a commit hash
because `crates/nemoclaw-sdk/build.rs` reads the revision from the
archive URL and checks it against the catalog. The documentation links
move to the same revision, and every linked path exists there.
- **What the tag brings:** `c6d1093d`, the current pin, is its parent.
The one new commit,
[NVIDIA/NeMo-Fabric#690](NVIDIA/NeMo-Fabric#690),
changes only Fabric's `README.md`. The tag has
[NVIDIA/NeMo-Fabric#434](NVIDIA/NeMo-Fabric#434),
[NVIDIA/NeMo-Fabric#633](NVIDIA/NeMo-Fabric#633),
[NVIDIA/NeMo-Fabric#652](NVIDIA/NeMo-Fabric#652),
[NVIDIA/NeMo-Fabric#667](NVIDIA/NeMo-Fabric#667),
[NVIDIA/NeMo-Fabric#668](NVIDIA/NeMo-Fabric#668),
[NVIDIA/NeMo-Fabric#685](NVIDIA/NeMo-Fabric#685)
and
[NVIDIA/NeMo-Fabric#689](NVIDIA/NeMo-Fabric#689)
as ancestors, and
[NVIDIA/NeMo-Fabric#676](NVIDIA/NeMo-Fabric#676)
as `b80becfc`, the same patch as its merge commit `56a4207b`. It keeps
the fixes for [#14529](#14529),
[#14537](#14537),
[#14538](#14538) and
[#14630](#14630), which earlier
pins brought.
- **Catalog:** `image/fabric/catalog.json` is regenerated; only its
revision and checksum change. The fixture image's digest, which covers
the catalog, moves in two cases, and so do the inference names derived
from it in `openshift-external-two-providers.tftest.hcl`.
- **Limits:** the agent rows are checked against the new pin. Fabric's
OpenClaw and Hermes adapters load bundled plugins and plugin folders
from a path you supply
([NVIDIA/NeMo-Fabric#680](NVIDIA/NeMo-Fabric#680),
[NVIDIA/NeMo-Fabric#681](NVIDIA/NeMo-Fabric#681),
which an earlier pin brought), so the two plugin rows now say what
remains:
  - NemoClaw doesn't download or install plugins.
- Because NemoClaw keeps each agent's state, a Hermes agent that
installs a plugin itself fails its next start with
`hermes_plugin_agent_installed_unsupported`. Fabric's tests don't show
an OpenClaw agent's own plugin staying usable after a restart
([NVIDIA/NeMo-Fabric#657](NVIDIA/NeMo-Fabric#657)).
- The rows for NVIDIA/NeMo-Fabric#565, #656 and `acknowledge_recovery`
still hold and are re-dated.
- **Release notes:** a line under "Changes Since v0.1.0-rc11".

## Beyond CI

- On linux/arm64, `cargo ci live-docker` and `cargo ci live-kind` passed
with the pin commit.
- `image/fabric/catalog.py`, run with `/opt/fabric/bin/python` in the
OpenClaw image that `cargo ci live-docker` built, wrote a catalog
byte-identical to the committed one.
- I computed the archive's SHA-256 from codeload twice, with the same
result.

---------

Signed-off-by: Carlos Villela <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PR fixes a bug or regression

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

4 participants