fix(relinker): log Windows output when standard handles are missing #4062
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4062"
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 danzaio on 2026-10-11T22:26:56Z.
What
A Windows executable started without stdout or stderr handles had nowhere to send its startup and failure messages. The entry stub now checks both handles before loading host libraries. It sends each missing stream to
anyps5.logbeside the executable; both missing streams share the file. Existing handles are preserved, each run replaces the previous log, and a file-creation failure leaves startup unchanged.The implementation commit retains Doston Abdullayev's authorship. The documentation note in
docs/user/USAGE.mdis under the Windows runtime launch instructions, separate from the controller input section. That placement also avoids the insertion overlap with #3998.Closes #3282
Tested
Current branch HEAD:
b390831a5808666b39f2899cc5b19575a0ee38d5on pinned main5fe4bebec60ae1295aea301be28def2019b332ae.relinker,windows_stdio_host_ucrt, andwindows_stdio_host_msvcrtwithcmake --build C:/Users/admin/anyps5-build-3282 --target relinker windows_stdio_host_ucrt windows_stdio_host_msvcrt --parallel 1, then completed the full build withcmake --build C:/Users/admin/anyps5-build-3282 --parallel 1.ctest --test-dir C:/Users/admin/anyps5-build-3282 -R "^windows_import_modules$" -V: 1/1 passed. The test exercises actual UCRT and MSVCRT DLL fixtures, missing stdout and/or stderr, and both redirected handles; it validates MSVCRT imports__iob_funcandfputsdirectly frommsvcrt.dlland rejects API-set CRT imports.ctest --test-dir C:/Users/admin/anyps5-build-3282 --output-on-failure: 121/121 passed, 0 failed, 0 skipped (53.12 seconds).python -I tools/check_conventions.py --base 5fe4bebec60ae1295aea301be28def2019b332ae --head HEAD: passed.git diff --check 5fe4bebec60ae1295aea301be28def2019b332ae...HEAD: clean.885fa1c0a43c0c7c6bdb3a8a9d2e6f87c28ccff8.The red-green verification (failing without the logging code, passing with it restored) is historical, from the prior base
5aaf26bd325607f65bde28741a4e82ceaaf586c0; it was not rerun on this rebase. No Wine, Explorer launch, or full title/gameplay test. Upstream GitHub CI was not dispatched: our upstream permission is read-only (pull), while dispatch requires write, maintain, or admin permission.Checklist
mainsnapshot used for review/build (5fe4bebec60ae1295aea301be28def2019b332ae). GitHub's currentmainhas since advanced tod146ec1b667c3e34bebf817efcc094bdac393423; PR #4062 currently reports mergeable, and this branch was not rebased/tested against that later commit. No other open PR implements the missing-standard-handle fallback. #3786 captures output from processes its graphical launcher starts, using pipes andlast_run.log; it does not provide this fallback for direct launches without handles. #3579 composes cleanly, and the #3998 documentation overlap is resolved.NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by danzaio on 2026-10-12T03:55:24Z.
Head
b390831a5808666b39f2899cc5b19575a0ee38d5; the PR now targets maind146ec1b667c3e34bebf817efcc094bdac393423(our local build/tests used pinned5fe4bebec60ae1295aea301be28def2019b332ae). The#3998docs overlap is resolved, and#3579composes cleanly.windows_import_modulespassed 1/1 and the full local CTest suite passed 121/121. The related#3786launcher captures its own child output with pipes; it does not add the missing-handle fallback. Could an upstream collaborator run the required full build/CI for this head? I don't have dispatch permission.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T09:24:28Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/relinker/relinker/tests/test_windows_import_modules.pyL79-85core/relinker/elfpatcher/src/windows/WindowsImportBuilder.cppL8Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T10:47:37Z.
Reviewed the entry stub change (
WindowsEntryStubBuilder.cpp): the missing-handle check, the path-length bound againstPathCapacity, the restored directory terminator and the shared log handle for the two streams are correct. The tests cover missing stdout/stderr/both, redirected handles, replacement of a stale log, unavailable log, and startup errors reachinganyps5.log, on UCRT and MSVCRT DLLs. Local Linux build and ctest incore/relinkerpass; the Windows-only cases are covered by the full Build's windows job. Merging once it is green.