Skip to content

fix(libc): treat directories as case-insensitive when the host cannot report case sensitivity - #22683

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
rgvxsthi:fix/libc-case-insensitive-unsupported-query
Nov 26, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
rgvxsthi:fix/libc-case-insensitive-unsupported-query

Conversation

@rgvxsthi

Copy link
Copy Markdown
Contributor

What

CaseInsensitiveDirectoryWindows treats any failure of the FileCaseSensitiveInfo query as a case-sensitive directory. Hosts without per-directory case sensitivity answer that query with an error but look names up case-insensitively. Wine returns ERROR_CALL_NOT_IMPLEMENTED (checked on Wine 11.22). Windows versions or file systems that don't support this information class are expected to fail with ERROR_INVALID_PARAMETER or ERROR_NOT_SUPPORTED; I haven't checked those. On those hosts MatchNames then lists the whole directory through std::filesystem::directory_iterator for every lookup of a missing name, instead of one FindFirstFileExW for that name.

With this change, those errors (ERROR_CALL_NOT_IMPLEMENTED, ERROR_INVALID_PARAMETER, ERROR_NOT_SUPPORTED, ERROR_INVALID_FUNCTION) mean "case-insensitive". Any other failure keeps today's behaviour, and hosts that answer the query are unchanged. MatchNamesWindows filters FindFirstFileExW results with the same SameName comparison the listing uses, so the matched names are the same.

Tested

  • Linux, Wine 11.22, Windows build (MinGW GCC), Astro Bot (PPSA21567), through the AstroHybrid PC port, which ships AnyPS5 built from 319621b plus its own patch series. CaseInsensitiveDirectoryWindows and MatchNames are unchanged on current main, so the change was made on 319621b first and moved here as is.
  • Under Wine, GetFileInformationByHandleEx(..., FileCaseSensitiveInfo, ...) fails with error 120. A missing-name lookup in a 279-entry directory took 97 us through FindFirstFileExW and 852 us through a full listing (small MinGW program, same directory).
  • The title stats thousands of missing files while loading a level. With this change, the time from the title screen until the worldmap level data was loaded (automated boot, timed from the game log) went from 7.1 s to 2.0-2.5 s over repeated runs. A player-driven load of one level (Az-Tech Trail) took 32 s in one run, against 58-97 s in three runs before. These are wall-clock times, not Performance report summary lines: this setup runs the title through the AstroHybrid port, not AnyPS5's own renderer.
  • Not run: the AnyPS5 test suite on main. The behaviour only changes on hosts where the query fails, which CI's Windows runners don't produce.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

… report case sensitivity

CaseInsensitiveDirectoryWindows treated any failure of the FileCaseSensitiveInfo query as a case-sensitive directory. Hosts that cannot answer it look names up case-insensitively; Wine fails the query with ERROR_CALL_NOT_IMPLEMENTED. MatchNames then listed the whole directory for every lookup of a missing name instead of one FindFirstFileExW for that name. The errors a host gives for an unsupported information class now mean case-insensitive; other failures keep the previous behaviour.
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 9371 core/libs/prx/libc/src/General.cpp
PR 18190 core/libs/prx/libc/src/General.cpp
PR 20315 core/libs/prx/libc/src/General.cpp

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this; the points below are optional.

What I ran

Reviewed head f3d0378c8049fea14a2ea2952da29c6a80095dbb; no commands or tests were run. Read the prepared description, commits, manifest, diff, and the changed General.cpp ranges covering the changed function and its callers. No files were excluded from the review manifest.

Results

Check Result Note
Diff and targeted source review passed One changed source file
Automated tests not run No test run performed

Findings

Blocking

None.

Non-blocking

None.

Not verified

The author reports Windows/Wine and game-loading measurements; these were not independently verified. The AnyPS5 test suite was not run. No other files were read.

To get this to a good state

Nothing is required.

@ycbuzi

ycbuzi commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Tested f3d0378c80 merged into main, with the whole ctest suite on each machine below. Nothing fails that does not also fail on main on the same machine.

  • Windows Server 2022 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 99% tests passed, 3 tests failed out of 6181; 99% tests passed, 4 tests failed out of 6181. 4 of the failing tests fail on main too. run
  • Windows Server 2025 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 100% tests passed, 0 tests failed out of 6181; 99% tests passed, 1 tests failed out of 6181. 1 of the failing tests fail on main too. run

AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports.

@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head f3d0378c80, applied with git apply on main fd4aeed483 together with the other 28 PRs of one batch (#23796, #23923, #24367, #24370, #24409, #24486, #24587, #10623, #18903, #18941, #19461, #21018, #21303, #21451, #21965, #23477, #23478, #23726, #24463, #12827, #14127, #14991, #20063, #24103, #24331, #24508, #24565, #15838). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
none: no test of its own in this PR - -

Whole batch: the full ctest -j 12 (6523 tests) on the RTX 3080 has 5 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Intermittent in this run (pass when rerun alone, or known flaky): agc_driver_store_over_untracked. Traced to other PRs of the batch, each by reverting it and testing again: #24409 (guest_usbd); none is in this PR's area. Failing tests I could not trace to a single PR (reverting the likely candidates did not clear them): guest_net_dns_info, test_script_registration. The 2126 agc_/video tests on the iGPU have 2 failing: agc_driver_stencil_plane_memory, agc_driver_store_over_untracked (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

This was referenced Nov 21, 2026
@oneandonlydean
oneandonlydean merged commit 341a9ee into boykopovar:main Nov 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants