fix(relinker): preserve inputs when writing Windows diagnostics #4338
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4338"
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 ArjenS-LA on 2026-10-12T07:01:13Z.
What
--windows --windows-diagnosticswriteswindows-diagnostics-imports.txtin the current directory. If that path names the input executable or aliases a bundled module, conversion currently succeeds after truncating the source file. Add this report to the existing input/output collision preflight, before registry, module or executable output is written. The check uses the same file-identity comparison as other outputs, so hard links and symbolic links are covered.Reproducer: create the existing
main_fixture()ELF aswindows-diagnostics-imports.txt, then run from that directory:Before: exit 0, the 32,768-byte input becomes empty. After: exit 2 with
Windows import diagnostics output would overwrite the input executable, and the input remains byte-for-byte unchanged. The regression also covers bundled modules, hard links, optional registry output, and existing outputs that must remain untouched. Separate diagnostics files still get written or replaced; an input named like the report remains valid when diagnostics are disabled.Checked current open PR file inventory and related issues/PR discussions. #3970, #4140 and #4194 touch other parts of
main.cpp; none adds this preflight. Open usage-document changes affect other paragraphs/options. Merged #3495 and #3678 establish the existing registry/desktop collision behavior that this change extends. No dependency on those open PRs.Branch:
fix/diagnostic-input-preservation. Base:d06c06565717961104edecdab46ce61c8cc72a70. Fixed commit:4b6bb2f05928d8026d89459b22d3cba0a532ac6d.Tested
Windows 11 x64 (build 26200), supported WinLibs MinGW-w64 GCC 15.2.0 UCRT/POSIX/SEH r7, CMake 4.3.1, Ninja 1.13.2, Python 3.13.7. Synthetic ELF fixtures exercise the relinker executable and actual filesystem writes; no title, GPU, Linux/macOS guest execution or full library build was used for this fix.
Configured unchanged baseline
2ccbd376f86a0ab2dafca98749585e281f37d599intobuild-relinker-baselineand built itsrelinkertarget before modifying the C++ source. Configured the fixed tree separately intobuild-relinker:input_magicandinput_preservationare registered. Four unrelated tooling tests were excluded because their disposable repository fixtures create Git commits, which this local workflow currently disallows. No test timeout was raised.git diff --checkpasses.python tools/check_conventions.py --base origin/mainpasses on the submitted commit. No CI result is claimed.After fast-forwarding to current main, the targeted regression passed again. Relinker builds reported no work because their sources and build configuration were unchanged. No upstream CI result is claimed.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt (no new unimplemented paths).mdfiles or images added to the repository (attach them to this PR)