fix: measure free space on the NUP extraction volume #1391
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1391
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/nup-extract-destination-space"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
nup.py --extract out/new/nested --only romfsaborts withFileNotFoundErrorwhenout/newdoes not exist. The free-space message queries the immediate parent before the extractor can create it. For an existing destination on a mount or junction, the same lookup measures the parent volume.Resolve the extraction destination and measure the nearest existing directory. The game-free CLI regression exercises an existing destination and one with two missing levels. Both cases check where free space is measured and that extraction writes the fixture.
All 22 cases in
nx2/test_nup_paths.pypassed on macOS. This change improves the destination-space check. The cause of the disk exhaustion reported in #1388 still needs a reproduction.AI assistance from OpenAI Codex is recorded in the commit trailers.
This landed in the v2.0.12 branch (merged there for testing; it reaches
mainwith that release), so closing. Thanks!Reopened: closing this was a mistake on my side. It was tested in the v2.0.12 branch, and it will be merged into main here, so it shows as merged. Sorry for the noise.
Looks good. The old line asked for the free space of the immediate parent, which fails (FileNotFoundError from disk_usage) when out/new doesn't exist yet. Resolving the destination and walking up to the nearest existing directory fixes that. realpath also follows a symlink or junction at the destination, so the volume you report is the one the writes land on. extraction_path() already does the same realpath of the root, so the two agree. The loop terminates at the filesystem root, and shutil.disk_usage works the same on Windows and Linux (GetDiskFreeSpaceEx vs statvfs), so nothing platform-specific here.
The test is good: it asserts where disk_usage is called for both an existing and a two-levels-missing destination, and that the file is written. The
self.out.resolve()vsos.path.realpathcomparison should hold on Windows too (both resolve 8.3 names). nx2/test_nup_paths.py is picked up by run_all.py's nx2/test_*.py glob, so nothing to register.Overlaps, none blocking:
import errnoand a new test method further down the class). Different hunks from this one, so I'd expect them to merge cleanly in either order, but whichever lands second may need a trivial rebase of the test file.nx2/nup.py --extractcall in try/except; that is independent of this change.Nit: the free-space message is only informational, so nothing enforces it. It's fine as is, just noting that a too-small volume still fails at write time (which #1412/#1393 handle by cleaning up).
CI was still pending on the Python source checks (ubuntu and windows) when I looked, so worth a glance before merging.