test(font): move the console font aside instead of deleting it while its face is mapped #1172

Merged
emaurel merged 1 commit from upstream-pr/1172 into main 2026-10-08 05:20:25 +00:00
emaurel commented 2026-10-07 16:27:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by emaurel on 2026-10-07T16:27:38Z.


What

guest_system_font fails on Windows 10 (build 19045): the process ends with an uncaught std::filesystem::filesystem_error (exit code 0x20474343).

The test removes SST-Bold.otf while font, opened from that file, is still open, to check that the next EuropeanBold open falls back to NotoSans-Bold.ttf. sceFontOpenFontSet opens the file through FT_New_Face, and FreeType's Windows stream (builds/windows/ftsystem.c) keeps a mapped view of it for the life of the face. Windows refuses to delete a file with a mapped view (ERROR_ACCESS_DENIED), so std::filesystem::remove throws. Linux allows the unlink, and the Windows CI runner (windows-latest) passes.

The test now moves the file out of the font directory instead of deleting it. Windows allows renaming a file with a mapped view. Nothing is left at the original path, so the test still checks that:

  • the substitute opens once the console file is absent;
  • the open handle keeps its face (advance 70);
  • the open handle does not depend on the file at its original path.

The library is unchanged.

Tested

  • Windows 10 22H2 (build 19045), WinLibs GCC 15.2.0 x86_64-ucrt-posix-seh r7, Release, BUILD_TESTING=ON:
    • Before, on main 4e742835: guest_system_font fails 10 of 10 runs; the other 392 tests pass.
    • After: guest_system_font passes 10 of 10 runs (--repeat until-fail:10); full ctest on main 2b8f0b21 with this change: 394 of 394.
    • The cause was confirmed outside the project: a standalone program that maps a file the way ftsystem.c does (view kept, file and mapping handles closed) cannot delete it (error 5), can rename it, and can delete it right after UnmapViewOfFile.
  • Ubuntu 24.04 (WSL2), GCC 13.3.0: guest_system_font passes before and after the change (10 of 10 runs after).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4775481363 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1172). Originally posted by [emaurel](https://github.com/emaurel) on 2026-10-07T16:27:38Z. --- ### What `guest_system_font` fails on Windows 10 (build 19045): the process ends with an uncaught `std::filesystem::filesystem_error` (exit code `0x20474343`). The test removes `SST-Bold.otf` while `font`, opened from that file, is still open, to check that the next `EuropeanBold` open falls back to `NotoSans-Bold.ttf`. `sceFontOpenFontSet` opens the file through `FT_New_Face`, and FreeType's Windows stream (`builds/windows/ftsystem.c`) keeps a mapped view of it for the life of the face. Windows refuses to delete a file with a mapped view (`ERROR_ACCESS_DENIED`), so `std::filesystem::remove` throws. Linux allows the unlink, and the Windows CI runner (`windows-latest`) passes. The test now moves the file out of the font directory instead of deleting it. Windows allows renaming a file with a mapped view. Nothing is left at the original path, so the test still checks that: - the substitute opens once the console file is absent; - the open handle keeps its face (advance 70); - the open handle does not depend on the file at its original path. The library is unchanged. ### Tested - Windows 10 22H2 (build 19045), WinLibs GCC 15.2.0 `x86_64-ucrt-posix-seh` r7, Release, `BUILD_TESTING=ON`: - Before, on `main` `4e742835`: `guest_system_font` fails 10 of 10 runs; the other 392 tests pass. - After: `guest_system_font` passes 10 of 10 runs (`--repeat until-fail:10`); full `ctest` on `main` `2b8f0b21` with this change: 394 of 394. - The cause was confirmed outside the project: a standalone program that maps a file the way `ftsystem.c` does (view kept, file and mapping handles closed) cannot delete it (error 5), can rename it, and can delete it right after `UnmapViewOfFile`. - Ubuntu 24.04 (WSL2), GCC 13.3.0: `guest_system_font` passes before and after the change (10 of 10 runs after). ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1172
No description provided.