fix: validate cache paths before building from extracted folders #1397
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!1397
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/guard-extracted-build-cache"
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?
The Builder validates the output ROMFS and retained ExeFS cache paths for NUP builds and updates. When the source is an extracted folder pair, it skips the ROMFS check and checks retained ExeFS only after it has already started copying. A redirected output ROMFS folder can therefore receive writes through a Windows junction.
Use the existing cache guard for both destinations before copying or unpacking the selected folders. The game-free regression simulates a Windows reparse point and verifies that both input modes stop before staging ExeFS or changing cached files.
python3 -I -B tests/run_all.py --strict make_game_cachepassed on macOS. This change is independent of #1395 and the two patches merge cleanly.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 folder-pair branch now runs the same
check_cache_paths(out, (kept, romfs))guard the NUP and update branches already use, and it runs beforecopytree/unpack/link_or_copy, so nothing is staged when the output is redirected. The guard is the existing one (realpath containment plus symlink/reparse-point check viast_file_attributes), so a normal existingromfsor.hookshot_exefsdirectory still passes and valid caches aren't rejected. No new path rules were added, so the Windows drive/UNC/case handling is unchanged from the NUP path.The test change is sound: it runs the same simulated reparse point through both the NUP and
--romfs/--exefsmodes and checks thatwork/exefsisn't created, no extraction runs and the cache is untouched. The test file is picked up byrun_all.pyautomatically (tests/test_*.py), nothing to register.Overlap with the sibling PRs: #1395 edits this same
else:branch and the same test file, and #1393 touchesmake_game.pyandtests/test_make_game_cache.pytoo, so expect small rebase conflicts inrun_to_lift/that block depending on merge order (you say #1395 merges cleanly, which is plausible). #1391 and #1412 only touchnx2/nup.py/nx2/test_nup_paths.py, no overlap.CI: Python checks (ubuntu and windows), appimage and builder package all pass. A few jobs (Windows Vulkan llvm-mingw, SPIR-V lowering, actionlint) were still pending when I looked, but none of them exercise this change.