Skip to content

fix(scripts): backup-proffieboard-sdcard.sh tolerates du non-zero exit on macOS#363

Open
kenkoller wants to merge 1 commit into
mainfrom
fix/sd-backup-pipefail-tolerance
Open

fix(scripts): backup-proffieboard-sdcard.sh tolerates du non-zero exit on macOS#363
kenkoller wants to merge 1 commit into
mainfrom
fix/sd-backup-pipefail-tolerance

Conversation

@kenkoller
Copy link
Copy Markdown
Owner

Summary

  • scripts/hardware-test/backup-proffieboard-sdcard.sh aborted silently against macOS-mounted SD cards that contain .Spotlight-V100/ (which is most of them). The script printed the source-size header and then ended, never reaching rsync.
  • Root cause: line 40's du -sh "$SD_MOUNT" 2>/dev/null | sed 's/^/ /' — under set -euo pipefail, du exited non-zero from permission-denied on Spotlight metadata; stderr was already silenced, so the pipefail abort was invisible.
  • Fix: append || true to the two informational | sed pipelines that walk $SD_MOUNT (the du -sh summary on line 40 and the find -maxdepth 1 top-level listing on line 42). Comment in the script explains why. Downstream rsync, SHA256 manifest, and tree generation are unchanged and continue to enforce errors normally.

Observed

2026-05-18 against /Volumes/NO\ NAME on a 2.9 GB 89sabers V3.9-BT SD card. bash -x trace stopped right after the du | sed line.

Test plan

  • bash -n scripts/hardware-test/backup-proffieboard-sdcard.sh — parses clean
  • pnpm typecheck — 15/15 cached
  • pnpm test — 15/15 successful (web alone 3802/3802)
  • User to re-run against an SD with a Spotlight directory; script should reach rsync + SHA manifest

Notes

  • Independent fix; does not bundle with the W2-prime arc tracked in docs/research/V39BT_FLASH_NEXT_STEPS.md.
  • CHANGELOG entry under [Unreleased].

🤖 Generated with Claude Code

…t on macOS

The source-summary `du -sh "$SD_MOUNT" | sed ...` pipeline exited non-zero
under `set -o pipefail` when `du` hit permission-denied on macOS Spotlight
metadata (`.Spotlight-V100/`, `.fseventsd/`), aborting the script silently
before rsync ran. Stderr was already redirected to /dev/null, so the only
symptom was the script ending right after printing the size summary.

Tolerate non-zero exits on the two informational `| sed` pipelines that walk
`$SD_MOUNT` (the `du -sh` summary and the `find -maxdepth 1` top-level
listing). The rsync, SHA256 manifest, and tree generation downstream are
unchanged and continue to enforce errors normally.

Observed 2026-05-18 against /Volumes/NO\ NAME on a 2.9 GB 89sabers V3.9-BT
SD card. bash -x trace stopped right after the `du | sed` line.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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