fix: avoid mapfile in upload-release-to-gcs.sh#22
Conversation
mapfile is bash 4+; macOS ships bash 3.2 at /bin/bash, so the script errored with "mapfile: command not found" when run locally. Replace with a portable read loop.
PR SummaryLow Risk Overview Reviewed by Cursor Bugbot for commit 1738214. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Last line silently dropped if input lacks trailing newline
- Added '|| [[ -n "$line" ]]' to the while loop condition to ensure the last line is processed even without a trailing newline.
Or push these changes by commenting:
@cursor push dd8718b61c
Preview (dd8718b61c)
diff --git a/scripts/upload-release-to-gcs.sh b/scripts/upload-release-to-gcs.sh
--- a/scripts/upload-release-to-gcs.sh
+++ b/scripts/upload-release-to-gcs.sh
@@ -74,7 +74,7 @@
$DRY_RUN && echo "Mode: dry-run"
ASSETS=()
-while IFS= read -r line; do
+while IFS= read -r line || [[ -n "$line" ]]; do
[[ -n "$line" ]] && ASSETS+=("$line")
done < <(gh release view "$RELEASE_TAG" --repo "$REPO" --json assets \
--jq '.assets[] | select(.name | test("^vmlinux-.*\\.bin$")) | .name')You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit ce2d4f3. Configure here.
0cf91b6 to
3e32eb2
Compare
Matches fc-versions naming (e.g. v1.14.1_458ca91), so the convention is consistent across firecracker and kernel artifacts: vmlinux-<version>_<short_hash>/<arch>/vmlinux.bin


`mapfile` is bash 4+; macOS ships bash 3.2 at `/bin/bash`, so running the script locally errored with `mapfile: command not found`. Swap for a portable `while IFS= read -r line; do ASSETS+=("$line"); done < <(…)` loop.
Verified on `GNU bash 3.2.57` (macOS):
```
$ ./scripts/upload-release-to-gcs.sh --hash c1a568c --dry-run --bucket e2b-staging-fc-kernels
Release: 2026.05.11 (commit c1a568c)
Target: gs://e2b-staging-fc-kernels
Mode: dry-run
WOULD vmlinux-6.1.102-amd64.bin -> gs://e2b-staging-fc-kernels/vmlinux-6.1.102-c1a568c/amd64/vmlinux.bin
... (3 more)
Dry run complete. Already in GCS: 0.
```