fix(setup): measure target/ with POSIX du so macOS re-runs work - #17
Open
Ash-thiago wants to merge 1 commit into
Open
fix(setup): measure target/ with POSIX du so macOS re-runs work#17Ash-thiago wants to merge 1 commit into
Ash-thiago wants to merge 1 commit into
Conversation
`du -sBG` is GNU-only. BSD du (macOS) rejects it with a usage error and
exit 64, and under `set -euo pipefail` that aborts the whole install:
▶ CLI
✗ this run FAILED in CLI; the install is incomplete
# setup-runs.log: FAIL exit=64 in section CLI
No cargo output is printed, so the cause is invisible from the script's
own output.
It does not bite on a first install, because the measurement is guarded
by `[[ -d "${here}/target" ]]` and a fresh clone has no target/ yet. It
bites on every run after that, while README and docs/getting-started.md
both tell users `./setup.sh` is re-runnable.
Use POSIX `du -sk` and convert to whole GiB, rounding up to keep GNU
`-BG`'s ceiling semantics so the cap behaves identically. `|| true`
routes a partial-read failure to the existing "could not measure
target/; skipping the size cap" branch instead of killing the install.
Contributor
|
Hi, sorry about the delay I didn't see this PR. I am finishing up the compatibility and auto build of the mvp on the staging branch and I think I already did a similar fix. I will double check once I am done with the release flow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
./setup.shfails on macOS on every run after the first.du -sBGis GNUsyntax; BSD
durejects it with a usage error and exit 64, and underset -euo pipefailthat kills the install before anything is built.Both the README and
docs/getting-started.mddocument the script asre-runnable ("Re-run
./setup.shanytime to rebuild"), so on macOS thatinstruction currently cannot be followed.
How
Swap the GNU-only
du -sBGfor POSIXdu -skand convert KiB to whole GiB,rounding up so the cap keeps
-BG's ceiling semantics and behavesidentically.
|| trueroutes a partial-read failure onto the existing"could not measure target/; skipping the size cap" branch rather than
aborting the install.
Reproduce
Because
2>/dev/nullhides the usage error, the script prints no cause;~/.local/share/weft/setup-runs.logrecords onlyFAIL exit=64 in section CLI.Base branch
Targeting
mvp, notmain, deliberately:setup.shdoes not exist onmain(v1 architecture), so this only applies here. Flagging it since recentPRs default to
main.Linked issue
None — filing directly per CONTRIBUTING ("For small changes, just open a PR...
obvious bugs. No discussion needed.").
Type of change
Checklist
bash -n setup.shparses clean and a full./setup.sh --cli --daemonnow completes on macOS (it failed before).No Rust or frontend code touched, so
cargo/pnpmgates are unaffected.pnpm -C dashboard checkpasses (if frontend changed). — n/aTODOorFIXMEwithout a linked issue.Environment it was found on
macOS 26 (Darwin 25.6.0, arm64),
bash5.3.15 from Homebrew (i.e. thedocumented
brew install bashwas done),mvp@0a5339f.Anything reviewers should pay extra attention to
Two things I chose not to fold in, to keep this reviewable:
Rounding. GNU
-BGrounds up, so I kept a ceiling rather thantruncating. At a 60 GiB cap the difference is cosmetic, but matching the
old behaviour exactly seemed better than quietly changing when the cap trips.
stat -c %Y(two call sites in the same section) is also GNU-only.It is not fatal thanks to the
|| echo 0fallback, but on macOS bothpre_mtimeandpost_mtimebecome0and therefore always compare equal,so the script concludes the binary did not change and skips the stale
worker-image prune on every macOS build. Happy to fix in a separate PR if
you want it — it felt like a different bug from this one.