fix(tests): pass guest_system_font, exec_arguments and unwrap_self under a non-ASCII TEMP on Windows #12993
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12993"
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?
Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-29T19:20:56Z.
What
When
%TEMP%contains a non-ASCII character, as it does for any Windows profile likeC:\Users\José, the full suite on Windows fails 7 tests that pass otherwise. A path with spaces alone is fine. This PR fixes the three that are pure test bugs. Each of them mixes the two narrow encodings on MinGW:std::filesystem::path::string()andpath(const char*)are UTF-8, whilefopen,getenvand console tools use the ANSI or OEM code page.guest_system_font(GuestSystemFont.cpp:122) opened its stderr capture file withstd::fopen(path.string().c_str(), "wb"). It now uses_wfopen(path.c_str(), L"wb")on Windows andfopen(path.c_str())elsewhere.exec_arguments: theGuestExecHost.cppfixture built the second program's environment withstd::getenv, which returns ANSI bytes there.execvethen rejects that environment withexec: argument is not valid UTF-8, which is correct, since guest strings are UTF-8. A smallUtf8Environmenthelper now readsLD_LIBRARY_PATHandANYPS5_LOADEXEC_TEST_ROOTthroughGetEnvironmentVariableWand converts them to UTF-8. POSIX keepsgetenv.Root()already read the root this way.unwrap_self:test_new_output_inherits_the_destination_directory_aclranicacls.exewithtext=True, which Python 3.15's UTF-8 mode decodes as UTF-8.icaclswrites the OEM code page, so the reader thread raisedUnicodeDecodeError,stdoutcame backNone, and the assertion message itself raisedTypeError. Both calls now passencoding="oem", errors="replace". The test only runs on Windows, where that codec exists.Probe with the same toolchain (
TEMP=C:\x\tëmpünï):Not in this PR:
video_out_telemetryand the threeagc_worker_sampler_*tests also fail under such aTEMP. Their tests pass a UTF-8path.string()into production APIs that take a narrow path and open it with the ANSIfopen/ofstream. In production those paths come fromgetenv, also ANSI, so production is consistent there. A fix means changing those APIs to take paths (and reading the variables with the wide API), so it belongs in a separate PR.No production code changes here. The first exec from a title directory under such a path already works, since the runtime uses the wide APIs (
GetModuleFileNameW,temp_directory_path).Tested
Windows 11 Enterprise 10.0.22621 (code page 1252), Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Python 3.15, Ninja, Release,
BUILD_TESTING=ON, no Vulkan driver visible.mainbb04a4f1eawithTEMP=TMP=C:\x\tëmp dir ünï: 11 failures, against 3 with the normalTEMP(ngs2_pitchshift,guest_filesystem,guest_freebsd_clocks, all with open fixes). The other 8 are the 7 tests named above andguest_job_manager_worker_count, which fails under parallel load (#12085). WithTEMP=C:\x\temp with spaceall 7 pass, and withC:\x\tëmpünïall 7 fail.mainaf4e595327),unwrap_self,guest_system_fontandexec_argumentspass 3 of 3 (ctest --repeat until-fail:3) both withTEMP=C:\x\tëmpünïand with the normalTEMP.python tools/check_conventions.py --base origin/main: all checks passed.fopen(path.c_str())in place offopen(path.string().c_str()), which gives the same bytes on POSIX, and thegetenvbranch ofUtf8Environment.Coverage clarification — 2026-10-30
The two trophy tests are registered under
BUILD_TESTING, including Windows (guest_np_trophy_dataandguest_np_trophy_stats); the build definitions provide their Windows DLL-search paths. There is a distinction in the citedfopencalls: trophy data and trophy stats create a root withtemp_directory_path(), then callstd::filesystem::current_path(root). Every call to theirWritehelper passes an ASCII relative name, such asapp0/sce_sys/param.json. The non-ASCII TEMP prefix therefore is not converted to narrow bytes by thosefopen(path.string())calls. That is a source-level explanation, not proof of a historical pass.The same distinction applies to GuestFilesystem.cpp:924:
sizedis formed from the ASCII relativeanyps5-filesystem-test-...root at line571. Separate earlier Windows helpers do use TEMP, and a failure there can prevent reaching line924.I could not recover the original Windows per-test build/CTest manifest or verbose/JUnit logs from the retained local evidence, so I cannot establish whether those exact trophy tests were built, executed or passed in the reported non-ASCII-TEMP full run. Their absence from the seven-failure list is not enough to establish that. The retained exact-head Linux run selected only
guest_system_font,exec_argumentsandunwrap_self(three passes each); it adds no coverage of these trophy/filesystem cases or Windows TEMP.The explicit follow-up is to recover the original Windows per-test receipts, or qualify these cases in a future authorized Windows session with effective TEMP/TMP/CWD and exact build/test manifests retained. Windows remains paused; no new Windows execution or source change was made for this audit. AI-assisted: yes (Codex).
Earlier-head independent Windows validation, reported by bunbeans2-arch for topic
ee5055268b04dd00c8c236289dffd56744cdd96fagainst mainf7f03daf52: Windows 11 Pro 22631, i9-9900K, MSYS2 UCRT64 GCC 16.1, Release.guest_system_fontandexec_argumentspass 3/3 for each of theéand outside-code-pageЖtemporary paths, while main fails 3/3; normal-profile controls pass.unwrap_selfretains 26/78 subtest failures on both arms due to locale decoding of UTF-8 paths on Python 3.13; this is not a full-suite pass or a fix for those baseline failures. This is the contributor's run, not a new local Windows execution.Additional correction at
2365b1010c4577e2a5d2594aad8769e98b434be9, a normal fast-forward fromee5055268b04dd00c8c236289dffd56744cdd96f: nine test subprocesses now decode the CLI's UTF-8 output explicitly. This addresses the remainingunwrap_selffailures in the earlier-head Windows report above. The existing C++ path fixes and byte captures of Windowsicaclsoutput are unchanged.Linux Python synthetic verification of the exact parent and change, full 78-test suite:
éЖEvery accepted run has zero errors and the same two pre-existing platform skips (Windows ACL inheritance and supplementary-group inheritance). Each successful change run executes/passes 76 applicable tests. CP1252 is modeled only at the parent subprocess decoder on Linux; this is not a native Windows run. Conventions and whitespace checks pass. Initial partial-tree control staging omitted reference imports; the accepted matrix uses the complete pinned parent tree.
Source pins, nine-line patch, reproduction script and full six-arm logs/results, SHA-256
7d4bf9df1fa9bd588e222b304f36edd7c5a91b7d66e163abf4b9872317f82a32(upload/download verified). All inputs are synthetic; no game files or binaries included. AI-assisted: yes (Codex).Qualification update — 2026-10-30, repeat 2
Fresh actual Windows qualification at exact current public
2365b1010c4577e2a5d2594aad8769e98b434be9: Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, Python 3.15.1, native Windows ACP1252 and OEM437. Ran the unchanged complete 78-test unwrap_self suite separately with ASCII, é and Ж TEMP/TMP paths,PYTHONUTF8=0and-X utf8=0. Effective locale and stdout encoding are cp1252, UTF8 mode is 0, and PYTHONIOENCODING is unset; raw metadata records CWD and all three TEMP paths.Each context passes all 75 applicable cases with 3 existing Windows POSIX group/permission skips, zero failures/errors. The ACL/icacls case executes and passes in each context; its OEM decoding behavior is unchanged. This directly qualifies the published UTF8 subprocess-decoding fix on Windows and supersedes the earlier 26-error contributor result tied to its previous head for this fixture. No source/test changes, emulation of Windows locale, game/SDK/GPU or performance claim.
The initial incomplete source-archive setup errors are retained separately and are not counted as source failures or passes; the final archive includes and preflights the actual relinker fixture import chain. Complete successful harness: Windows FIFO request 177453aaad2e4943a7cf8e92ae271074. Evidence: https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/owned-current-windows-20261030-repeat2.tar.gz, SHA256 e423c97373758bf59239e02c138b74f35f1a45488793bc92878a4c836f94a584. AI-assisted: yes (Codex).
AI-assisted: yes (Codex).
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-29T20:45:52Z.
Review: APPROVED
I checked this on macOS at
ee5055268b. I didn't run the real Windows suite.af4e595327is inmain951f374c87.git merge-treeagainst main is clean,git diff --checkis clean, andcheck_conventions.pypasses.pr_overlap.pyfound 0 of 1447 open PRs sharing files or exports.x86_64-w64-mingw32-g++andclang++ -target x86_64-apple-macoswith-fsyntax-only -std=gnu++20report 0 errors on both changed C++ files.temp_directory_path() / L"tëmpünï".fopen(path.string().c_str(), "wb")fails and_wfopen(path.c_str(), L"wb")opens. I also copiedUtf8Environmentin unchanged and gave it a value ofC:\x\tëmpünï\😀. It returns43 3a 5c 78 5c 74 c3 ab 6d 70 c3 bc 6e c3 af 5c f0 9f 98 80, which is correct UTF-8 including the non-BMP surrogate pair. An unset variable returnsfalse.tools/tests/test_unwrap_self.pyon Python 3.13 macOS: 78 OK, 1 skipped (thewin32-only ACL test).Optional, not blocking: the same
std::fopen(path.string().c_str(), "wb")on atemp_directory_path()root also appears inGuestNpTrophyData.cpp:86andGuestNpTrophyStats.cpp:104. Both tests are registered for Windows, and neither is in your list of 7. Were they not built in that run, or did they pass?GuestFilesystem.cpp:924has the same pattern, butguest_filesystemalready fails for another reason, so this one is hidden.AI-assisted: yes