Repository navigation
Conversation
5 of 12 tasks
…tolerate entries that vanish in rmtree macOS writes an AppleDouble `._<name>` beside every file on an exFAT / FAT drive. Its name carries the game's [title ID], so scan_nsps read `._Update [..800].nsp` as a second update and the folder was ambiguous. `._*` is skipped now. The kernel also drops `._x` when `x` is deleted, so shutil.rmtree's walk could list `._x` and then find it gone; before Python 3.13 that FileNotFoundError aborted the removal and left the folder half deleted. The script's rmtree now passes ENOENT (the goal, "gone", is reached) and raises everything else. Part of seedds#388.
v0lumehi
force-pushed
the
nsp-external-drive
branch
from
October 28, 2026 02:02
c635634 to
c6a2bf6
Compare
seedds
added a commit
that referenced
this pull request
Oct 28, 2026
…nd survives their removal (#476) exFAT and FAT have no extended attributes, so macOS keeps a file's (a download's quarantine flag) in an AppleDouble `._<name>` beside it and deletes it with the file. Two things went wrong on such a drive: - scan_nsps listed `._Update [<title ID>800].nsp`, 4 KB of metadata whose name carries the title ID, as a second update; an untagged update then read as two and was left out. Names starting with `._` are skipped. - Deleting `x` takes `._x` with it, so shutil.rmtree's later unlink of the listed `._x` raised FileNotFoundError, which before Python 3.13 ended the removal and left a half-deleted folder. The script's rmtree passes ENOENT through an onexc hook (Python 3.12 is the floor) and raises every other error. Nothing is keyed to a game. On top of the PR: the pre-3.12 onerror branch is dropped, the test's stand-in unlink joins the partner's directory (it was correct only for the dir_fd walk), and docs/reference/packing.md has the entry, linked from docs/development.md and the symptom index. Checked: on an exFAT disk image (hdiutil -fs ExFAT) main's scan_nsps listed the `._` copy as an update and deleting `a` removed `._a`; the patched scan finds one update and rmtree removes a tree holding 55 `._` files. test_nsp_external_drive.py passes on Python 3.14 and 3.15, all 148 test_nsp_* and test_docs.py pass, and the pinned lint ratchet reports 0 new findings. Python 3.12 was not available here; the author ran the tests on 3.12, where the rmtree and scan tests fail without the change. Co-authored-by: v0lumehi <[email protected]>
Owner
|
Thanks — merged into main as a0b8bdb, with you as co-author. Both bugs were confirmed on main using an exFAT disk image (
The design is kept as you wrote it. Changes on top:
Checked: on the exFAT image, the patched scan finds one update and |
seedds
added a commit
that referenced
this pull request
Oct 28, 2026
title_of falls back to the [title ID] in a file's name when the file holds no ticket, so scan_nsps took any file with a game's extension and tag for one of its packages: an AppleDouble `._` copy on an exFAT drive (#476), a failed download saved under the game's name, a file cut off before its header. One such file beside an untagged update made it one of two and left it out. is_package checks what nx_extract's OpenNsp opens: an XCI / XCZ by the card header's HEAD at 0x100, else a PFS0 (NSP, NSZ). scan_nsps skips any other file with a line saying why; `._` files are still skipped without one. Nothing is keyed to a game. Checked: dm/tools/tests/test_nsp_scan.py (an XCI base without a ticket, a tagged HTML page and a truncated XCI beside a real update, a quiet `._` skip) fails without the change and passes with it; all 150 test_nsp_*, test_docs.py and test_bug_report.py pass; the pinned lint ratchet reports 0 new findings. is_package accepts all 339 packages on the T7 drive (336 NSPs, 3 XCIs); no NSZ / XCZ there, those are covered by the tests only.
MIsaacM
added a commit
to MIsaacM/nxnative-lab
that referenced
this pull request
Oct 30, 2026
…s#555, seedds#476) Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 of 3 tasks
Know-It-All-Brother
pushed a commit
to Know-It-All-Brother/nxnative
that referenced
this pull request
Nov 9, 2026
…nd survives their removal (seedds#476) exFAT and FAT have no extended attributes, so macOS keeps a file's (a download's quarantine flag) in an AppleDouble `._<name>` beside it and deletes it with the file. Two things went wrong on such a drive: - scan_nsps listed `._Update [<title ID>800].nsp`, 4 KB of metadata whose name carries the title ID, as a second update; an untagged update then read as two and was left out. Names starting with `._` are skipped. - Deleting `x` takes `._x` with it, so shutil.rmtree's later unlink of the listed `._x` raised FileNotFoundError, which before Python 3.13 ended the removal and left a half-deleted folder. The script's rmtree passes ENOENT through an onexc hook (Python 3.12 is the floor) and raises every other error. Nothing is keyed to a game. On top of the PR: the pre-3.12 onerror branch is dropped, the test's stand-in unlink joins the partner's directory (it was correct only for the dir_fd walk), and docs/reference/packing.md has the entry, linked from docs/development.md and the symptom index. Checked: on an exFAT disk image (hdiutil -fs ExFAT) main's scan_nsps listed the `._` copy as an update and deleting `a` removed `._a`; the patched scan finds one update and rmtree removes a tree holding 55 `._` files. test_nsp_external_drive.py passes on Python 3.14 and 3.15, all 148 test_nsp_* and test_docs.py pass, and the pinned lint ratchet reports 0 new findings. Python 3.12 was not available here; the author ran the tests on 3.12, where the rmtree and scan tests fail without the change. Co-authored-by: v0lumehi <[email protected]>
Know-It-All-Brother
pushed a commit
to Know-It-All-Brother/nxnative
that referenced
this pull request
Nov 9, 2026
title_of falls back to the [title ID] in a file's name when the file holds no ticket, so scan_nsps took any file with a game's extension and tag for one of its packages: an AppleDouble `._` copy on an exFAT drive (seedds#476), a failed download saved under the game's name, a file cut off before its header. One such file beside an untagged update made it one of two and left it out. is_package checks what nx_extract's OpenNsp opens: an XCI / XCZ by the card header's HEAD at 0x100, else a PFS0 (NSP, NSZ). scan_nsps skips any other file with a line saying why; `._` files are still skipped without one. Nothing is keyed to a game. Checked: dm/tools/tests/test_nsp_scan.py (an XCI base without a ticket, a tagged HTML page and a truncated XCI beside a real update, a quiet `._` skip) fails without the change and passes with it; all 150 test_nsp_*, test_docs.py and test_bug_report.py pass; the pinned lint ratchet reports 0 new findings. is_package accepts all 339 packages on the T7 drive (336 NSPs, 3 XCIs); no NSZ / XCZ there, those are covered by the tests only.
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
NX2Apple users keep their games on exFAT / FAT external drives, and the fork carries two patches for what that does to
scripts/build_ipa_from_nsp.py. This moves them upstream so forks can drop them (#388).._<name>beside every file on such a drive.._Update [<title ID>800].nspis 4 KB of metadata, butscan_nspslists files by extension and reads the title ID from the name, so it counted as another update (an untagged update then read as two and was left out of the build).scan_nspsis the only place the script lists game files; it skips names starting with._.rmtree. On the volume._xgoes away whenxis deleted, so the walk lists._xand then finds it gone. Before Python 3.13shutil.rmtreepassed that FileNotFoundError to the caller, which aborted the removal and left a half-deleted folder that the nextcopytree/renamefailed on. The script'srmtree("make this path gone") now passes ENOENT and raises every other error. Python 3.13 and later tolerate this in the standard library; the project floor is 3.12, so the handler is still needed.Part of #388.
Checked
dm/tools/tests/test_nsp_external_drive.py(new: scan with._copies of an NSP, XCI, NSZ and XCZ beside the real files; rmtree where deletingxremoves._x, simulated; rmtree still raises PermissionError), withtest_docs.pyand the othertest_nsp_*.py: 81 pass. On Python 3.12 the new rmtree and scan tests fail without the change; on 3.14 only the scan test does, since the standard library already tolerates the race there.Docs
docs/development.md(game folders on exFAT / FAT drives)