fix(relinker): preserve Windows extended-path arguments #9793

Merged
Iluminatti312 merged 2 commits from upstream-pr/9793 into main 2026-11-02 07:58:42 +00:00
Iluminatti312 commented 2026-10-22 15:20:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Iluminatti312 on 2026-10-22T15:20:21Z.


What

Fix Windows extended-length path (\\?\) handling in the relinker.

MinGW-w64 wildcard expansion interprets the ? in the path prefix before the argument reaches wmain(). This can truncate the input path and cause Cannot open file errors.

  • Disable MinGW-w64 command-line wildcard expansion for the relinker.
  • Preserve Windows device-prefixed output paths instead of incorrectly passing them through std::filesystem::absolute().
  • Add a Windows regression test covering normal and extended-prefixed input/output paths, including the generated PE executable and registry file.

Before the fix, the new test failed with Cannot open file: \\input.elf. After the fix, both cases pass.

Tested

  • Windows 11 Pro, GCC 15.2.0 (MinGW-w64), Ninja, relinker-only Release build.
  • Regression test confirmed failing before the fix and passing after the fix (RED → GREEN).
  • Full CTest suite before rebase: 234 passed, 1 skipped, 0 failed.
  • After rebase onto upstream main: 3 relevant tests passed, 1 skipped, 0 failed.
  • python tools/check_conventions.py --base upstream/main — passed.
  • python tools/check_test_registration.py --scripts — passed.
  • No PS5 title or homebrew tested; verification uses the existing ELF test fixture.

The existing long_paths test is skipped because Windows LongPathsEnabled is disabled. This change does not claim verified support for all paths longer than MAX_PATH.

Checklist

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4969764574 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9793). Originally posted by [Iluminatti312](https://github.com/Iluminatti312) on 2026-10-22T15:20:21Z. --- ### What Fix Windows extended-length path (`\\?\`) handling in the relinker. MinGW-w64 wildcard expansion interprets the `?` in the path prefix before the argument reaches `wmain()`. This can truncate the input path and cause `Cannot open file` errors. - Disable MinGW-w64 command-line wildcard expansion for the relinker. - Preserve Windows device-prefixed output paths instead of incorrectly passing them through `std::filesystem::absolute()`. - Add a Windows regression test covering normal and extended-prefixed input/output paths, including the generated PE executable and registry file. Before the fix, the new test failed with `Cannot open file: \\input.elf`. After the fix, both cases pass. ### Tested - Windows 11 Pro, GCC 15.2.0 (MinGW-w64), Ninja, relinker-only Release build. - Regression test confirmed failing before the fix and passing after the fix (RED → GREEN). - Full CTest suite before rebase: **234 passed, 1 skipped, 0 failed**. - After rebase onto upstream `main`: **3 relevant tests passed, 1 skipped, 0 failed**. - `python tools/check_conventions.py --base upstream/main` — passed. - `python tools/check_test_registration.py --scripts` — passed. - No PS5 title or homebrew tested; verification uses the existing ELF test fixture. The existing `long_paths` test is skipped because Windows `LongPathsEnabled` is disabled. This change does not claim verified support for all paths longer than `MAX_PATH`. ### 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)](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [[technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt)](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-22 16:24:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T16:24:41Z.

Review: DISMISSED


I inspected the MinGW wildcard-expansion fix, preserved device/extended output path handling, and regression test. The exact PR head cross-compiled successfully as a Windows relinker with MinGW-w64 GCC 12. I could not execute windows_extended_paths here because this Linux environment has no Windows runtime/Wine; the PR reports that test passing on Windows 11 with GCC 15.2, and the hosted checks currently cover conventions, intake and labels only.

The branch is eight commits behind current main (8499ea52e571b0edfc1feecfd3f6b9944012b359). CONTRIBUTING.md requires branches to be based on and kept up to date with main. Please update it and rerun the focused Windows regression test after the rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5617494532 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9793#pullrequestreview-5617494532). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T16:24:41Z. **Review:** DISMISSED --- I inspected the MinGW wildcard-expansion fix, preserved device/extended output path handling, and regression test. The exact PR head cross-compiled successfully as a Windows relinker with MinGW-w64 GCC 12. I could not execute `windows_extended_paths` here because this Linux environment has no Windows runtime/Wine; the PR reports that test passing on Windows 11 with GCC 15.2, and the hosted checks currently cover conventions, intake and labels only. The branch is eight commits behind current `main` (`8499ea52e571b0edfc1feecfd3f6b9944012b359`). CONTRIBUTING.md requires branches to be based on and kept up to date with `main`. Please update it and rerun the focused Windows regression test after the rebase.
MarcZX10 commented 2026-10-22 16:55:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T16:55:51Z.

Review: COMMENTED


The updated exact head dc4a48abc4d665938ea5e826630ca02fe3b38a40 now rebases onto current main (499b1cf9fc), and the focused Windows regression rerun is reported after the rebase. Current-main conventions, git diff --check, and merge-tree checks pass. The hosted relinker matrix is not present in the current check set, so I’m treating the Windows test result as contributor-reported. I could not run the Windows-only regression in this Linux VM because it has no Windows runtime. The earlier base/test requests are addressed; no additional issue found in the path handling on inspection.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5617847076 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9793#pullrequestreview-5617847076). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T16:55:51Z. **Review:** COMMENTED --- The updated exact head `dc4a48abc4d665938ea5e826630ca02fe3b38a40` now rebases onto current `main` (`499b1cf9fc`), and the focused Windows regression rerun is reported after the rebase. Current-main conventions, `git diff --check`, and merge-tree checks pass. The hosted relinker matrix is not present in the current check set, so I’m treating the Windows test result as contributor-reported. I could not run the Windows-only regression in this Linux VM because it has no Windows runtime. The earlier base/test requests are addressed; no additional issue found in the path handling on inspection.
MarcZX10 commented 2026-10-29 09:59:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T09:59:58Z.

Review: CHANGES_REQUESTED


Re-check — changes requested

I re-read the Windows report and exact head dc4a48abc4d665938ea5e826630ca02fe3b38a40. It confirms that the current regression test covers only --skip-sce-module; it does not show a successful default module conversion. In the current patch, the input and module-root paths still pass through std::filesystem::absolute(), and the test has no default-module case. The reported default conversion still fails while deriving the guest-module parent from an extended path, so the reported windows_extended_paths pass does not cover the failing path.

Please preserve the Windows namespace prefix consistently through input, module-root and output derivation, and add a regression that runs default module processing with extended input and output paths. Keep the existing identity/overwrite protections and retain the --skip-sce-module case as a separate control.

There is also a current-main integration blocker: after refreshing to f7e84c4cf1609cc10bac95a44cd431805e5ebc8a, tools/check_main_sync.py reports a conflict in core/relinker/main.cpp (the branch is based on 499b1cf9f). Please reconcile the newer main changes and rerun the Windows regression on that integrated head. git diff --check passes; I cannot execute the Windows-only test in this Linux environment.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5695897861 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9793#pullrequestreview-5695897861). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T09:59:58Z. **Review:** CHANGES_REQUESTED --- # Re-check — changes requested I re-read the Windows report and exact head `dc4a48abc4d665938ea5e826630ca02fe3b38a40`. It confirms that the current regression test covers only `--skip-sce-module`; it does not show a successful default module conversion. In the current patch, the input and module-root paths still pass through `std::filesystem::absolute()`, and the test has no default-module case. The reported default conversion still fails while deriving the guest-module parent from an extended path, so the reported `windows_extended_paths` pass does not cover the failing path. Please preserve the Windows namespace prefix consistently through input, module-root and output derivation, and add a regression that runs default module processing with extended input and output paths. Keep the existing identity/overwrite protections and retain the `--skip-sce-module` case as a separate control. There is also a current-main integration blocker: after refreshing to `f7e84c4cf1609cc10bac95a44cd431805e5ebc8a`, `tools/check_main_sync.py` reports a conflict in `core/relinker/main.cpp` (the branch is based on `499b1cf9f`). Please reconcile the newer main changes and rerun the Windows regression on that integrated head. `git diff --check` passes; I cannot execute the Windows-only test in this Linux environment.
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!9793
No description provided.