fix(arcup): check disk space in TMP_DIR, not just BIN_DIR - #304
fix(arcup): check disk space in TMP_DIR, not just BIN_DIR#304batuhankocyigit wants to merge 3 commits into
Conversation
Add comments to clarify TMP_DIR usage and disk space checks.
|
Verified this independently at Confirmed on
Review point 1 — the 1000MB constant is ~5.4x the measured need. I downloaded and extracted the real v0.8.0 Review point 2 (observed, not this PR's fault) — on curl 8.14.x, The recurring gap: no |
|
Thanks for the thorough verification genuinely useful. Point 1 (1000MB → 300MB): Fair, that was instinct ("2x the default") not Point 2 (curl 8.14 --retry/--fail bug): Agreed this should be separate — Version bump: Bumped Pushed both fixes to the same branch. 27/27 still green locally. |
|
Opened #309 for the curl 8.14 issue. |
Summary
main()inarcup/arcupcallscheck_disk_spaceexactly once, onBIN_DIR:But the release archive is downloaded into
TMP_DIR(mktemp -d, usually/tmp) and also extracted there before the binaries are copied toBIN_DIR. SoTMP_DIRbriefly needs to hold both the compressed archiveand its extracted contents (~2x the final install size), and it is never
checked at all.
TMP_DIRandBIN_DIRare frequently different filesystems — e.g./tmpis a small tmpfs in many containers/CI images while
BIN_DIR(
$ARC_DIR/bin, under$HOME) sits on a much larger disk. In that case theBIN_DIRcheck passes even though there isn't enough room inTMP_DIR, andthe user gets an opaque
curl/tarfailure instead of the intendedfriendly
Insufficient disk spaceerror.Fix
Add a
check_disk_spacecall forTMP_DIRas well, with a higherthreshold (1000MB vs. the 500MB default) since it temporarily holds both
the archive and its extracted contents.
Testing
test_check_disk_space_rejects_insufficient: direct unit test thatcheck_disk_spaceerrors withInsufficient disk spacewhen therequired size exceeds what's available.
test_main_checks_tmp_dir_disk_space: end-to-end regression test.Points
TMPDIRat a directory whose fakedfoutput reports ~1MB freewhile
BIN_DIRreports effectively unlimited space, runs the realarcupbinary viaarcup -i 1.2.3, and asserts it fails with theInsufficient disk spacemessage (proving the failure comes from the newTMP_DIRcheck and not the pre-existingBIN_DIRcheck).new).
No functional changes outside
arcup/arcupandarcup/test_arcup.sh.