Skip to content

Mac app: skip the exFAT "._" files that break the pack (patch 0056) - #487

Closed
lucaszhongsj wants to merge 2 commits into
LNPANDY:mainfrom
lucaszhongsj:fix/mac-app-exfat-detritus
Closed

lucaszhongsj wants to merge 2 commits into
LNPANDY:mainfrom
lucaszhongsj:fix/mac-app-exfat-detritus

Conversation

@lucaszhongsj

Copy link
Copy Markdown
Contributor

Fix or feature

  • Fix
  • Feature

What and why

Fixes #486.

dm/mac/pack_app.py breaks when the build folder or the app is on exFAT, which is what an external drive gives you when the internal one cannot hold an 8 GB RomFS and a 19 GB app per game. exFAT has no native extended attributes, so macOS keeps each file's xattrs in an AppleDouble file named ._<name> beside it, and the pack trips over them three times:

  • the input globs (MODULE_FILES, MSL_FILES, PSO_FILES, *.ttf) match ._main.patched.bin and ._..._b.metallib as if they were modules and shaders — no rewriter fixups for .../._main.patched.bin, later no input file at .../._1785f88868f76e74_b.metallib;
  • shutil.copy2 of the host cannot set the flags of the copy (chflags: Operation not permitted), and cp -R carries the sidecars into the bundle (DMModuleFiles in the built Info.plist listed 18 ._* entries);
  • codesign reads Contents/MacOS/._nxnative as a nested code object that is not signed and refuses the whole bundle: code object is not signed at all.

The patch (0056) does three things: it drops those names from the input globs; it copies without extended attributes (cp -X where it is not cloning, shutil.copy instead of copy2 for the host) so a copy no longer creates them; and it strips what a copy or the compiler still leaves from the staged bundle before codesign reads it, retrying once with the attributes cleared, and strips again after signing because codesign sets an attribute on what it signs.

On APFS nothing changes: no ._ file exists there, cp -c still clones, and the two strip_detritus walks are a stat pass over the staged tree.

Checked

  • Tests: python3 tools/engine.py check — patch queue ok, 35 patches apply cleanly to cd859c38a8f8. The engine's dm/tools/tests/test_nsp_mac_app.py — 45 tests pass, including the new test_finder_detritus_is_not_an_input_and_never_reaches_the_bundle (a ._ file in every input folder is not selected, does not reach the bundle, and is not listed in DMModuleFiles).
  • Visual QA: not applicable, no launcher change.
  • Run on a device or Mac: This Mac (MacBook Pro 18,3, M1 Pro, macOS 27.2), build folder and output on an exFAT USB volume. The Legend of Zelda: Echoes of Wisdom, 01008CF01BAAC000, update 1.1.0 (v196608): the Mac app step that used to stop at no input file at .../._1785f88868f76e74_b.metallib now completes with step: signing (ad-hoc) and app: /Volumes/Fridge/01008CF01BAAC000.app, codesign --verify --strict passes and the bundle holds no ._ file. The same pack against the same inputs with the unpatched script fails in all three places above.
    Not checked: the game was not played from that app for this patch, and no iPhone target was built.

Screenshots

None, no visible change.

Scope

  • No engine file (dm/, scripts/, docs/, ref/) is added to the repository: a change there is a patch in patches/ (a commit in engine/, then tools/engine.py export, and tools/engine.py check passes), with its Upstream-Status
  • A fix to the engine or a game profile also goes to seedds/nxnative as a PR in parallel: this PR's patch says forwarded seedds/nxnative#..., or pending until that PR is open
  • A change to a launcher view has before and after screenshots above
  • No keys, game files or data extracted from a game in the change or the attachments

The patch says Upstream-Status: pending: I have no fork of seedds/nxnative to open that pull request from. Could a maintainer forward it, or tell me where to send it?

Patch 0056. On a volume without native extended attributes (exFAT, an
external drive for the build folder or the app) every file's attributes
live in a "._name" file beside it. The input globs take those for modules,
shaders and fonts, the copies carry them into the bundle, and codesign
reads the one beside the launcher as a code object that is not signed, so
the whole pack fails.

Fixes LNPANDY#486.
@github-actions github-actions Bot added the patch-queue Changes the patch queue or the upstream pin label Nov 2, 2026
@v0lumehi v0lumehi added this to the v1.0.2 milestone Nov 2, 2026
@v0lumehi

v0lumehi commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the fix and for the three failures you traced. Engine changes go to seedds/nxnative first, as CONTRIBUTING.md and patches/README.md describe. Could you open the matching pull request there and put its number in the patch header (Upstream-Status: forwarded seedds/nxnative#N)? If you cannot, tell me and a maintainer sends it. The patch number is given out when the pull request merges, so you do not need to chase it. The number 0056 is also used by other open PRs, so it will change when this one merges. I put it in v1.0.2.

@lucaszhongsj

Copy link
Copy Markdown
Contributor Author

Forwarded: seedds/nxnative#991 — patch 0056 now says Upstream-Status: forwarded seedds/nxnative#991.

That upstream PR carries the same change plus the reference entry in docs/reference/packing.md (## External drives, the third AppleDouble case after #476 and #555) and the regenerated docs/agents/symptoms.md. This patch stays the code and its test only, so it drops whole on the next bump once upstream has it.

Understood on the number — I will not chase it.

@v0lumehi

v0lumehi commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Thanks @lucaszhongsj, and thanks for forwarding it as seedds/nxnative#991. I carry your commit into the next patch number in a new stack for v1.0.2, with you as author. When that PR is up I close this one with a link. The patch drops on the next engine bump once upstream has #991.

@v0lumehi

v0lumehi commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Thanks @lucaszhongsj. Your commit is in main as patch 0057 (#521), with you as author and Upstream-Status: forwarded seedds/nxnative#991. The patch drops on the next engine bump once upstream has #991. I close this PR as done.

@v0lumehi v0lumehi closed this Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch-queue Changes the patch queue or the upstream pin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mac app: a build or output folder on exFAT breaks the pack (._ sidecar files reach the inputs, the copies and codesign)

2 participants