fix(relinker): accept trailing separators on the Windows origin path #4337

Merged
ArjenS-LA merged 1 commit from upstream-pr/4337 into main 2026-10-12 15:51:58 +00:00
ArjenS-LA commented 2026-10-12 07:00:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ArjenS-LA on 2026-10-12T07:00:56Z.


What

relinker --windows --rpath '$ORIGIN/' ... rejects a valid executable-directory library path with Ambiguous Windows run path, while $ORIGIN succeeds. Normalization strips the prefix to an empty string and reads back() before constructing a rooted path.

Normalize the emptied prefix to .. Both slash and backslash forms now resolve beside the executable. The regression generates a provider, converts a consumer with five equivalent runpaths, and on Windows executes each consumer from another working directory. Each must load the adjacent provider and return its value, 77.

Base: d06c06565717961104edecdab46ce61c8cc72a70.
Branch: fix/windows-origin-slash.
Fixed commit: e2c24cf038b9bb5f200a666b2b5fedf2fdf10ff9.

Tested

Windows x86-64, OS build 10.0.26200, supported WinLibs MinGW-w64 GCC 15.2.0 (x86_64-ucrt-posix-seh, r7), Python 3.13.7.

  • Identical test_windows_runpath.py fails on baseline at $ORIGIN/, after the bare $ORIGIN control successfully converts and executes. The fixed test passes with $ORIGIN, $ORIGIN/, $ORIGIN\, $ORIGIN/. and .; all five generated consumers load the provider and exit 77.
  • Baseline binary built at b42ef24e07725ba1166420073817d80a60ec9149; current base d06c06565717961104edecdab46ce61c8cc72a70 has identical relinker, build and tooling sources. The fixed build uses the current base.
  • Relinker-only Release build with BUILD_TESTING=ON and explicit Python3_EXECUTABLE succeeds; Python-backed input_magic is registered.
  • ctest --test-dir build-relinker-origin-slash --output-on-failure -E 'conventions_function_bodies|conventions_wrapped_declarations|import_audit|pr_overlap_encoding' -j 4: 119/119 pass in 18.02 seconds. The four excluded tooling tests create disposable Git commits and were not repeated under the personal commit quota; baseline Python tooling tests already passed 178 tests with two Windows symlink skips.
  • git diff --check passes. python tools/check_conventions.py --base origin/main passes on the submitted commit.

This includes execution of generated Windows fixture executables and their provider. No game/title, GPU, Linux/macOS runtime or upstream CI validation is claimed.

Reviewed the complete open-PR file inventory and the diffs/discussions of #3579, #3965, #3970 and #4062, which also edit Windows startup construction. None changes normalizeRunPath or addresses this failure. No dependency on those changes.

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

  • 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
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt — no runtime exports changed
  • 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 — none added
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes — OpenAI Codex
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4826010324 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4337). Originally posted by [ArjenS-LA](https://github.com/ArjenS-LA) on 2026-10-12T07:00:56Z. --- ### What `relinker --windows --rpath '$ORIGIN/' ...` rejects a valid executable-directory library path with `Ambiguous Windows run path`, while `$ORIGIN` succeeds. Normalization strips the prefix to an empty string and reads `back()` before constructing a rooted path. Normalize the emptied prefix to `.`. Both slash and backslash forms now resolve beside the executable. The regression generates a provider, converts a consumer with five equivalent runpaths, and on Windows executes each consumer from another working directory. Each must load the adjacent provider and return its value, 77. Base: `d06c06565717961104edecdab46ce61c8cc72a70`. Branch: `fix/windows-origin-slash`. Fixed commit: `e2c24cf038b9bb5f200a666b2b5fedf2fdf10ff9`. ### Tested Windows x86-64, OS build 10.0.26200, supported WinLibs MinGW-w64 GCC 15.2.0 (`x86_64-ucrt-posix-seh`, r7), Python 3.13.7. - Identical `test_windows_runpath.py` fails on baseline at `$ORIGIN/`, after the bare `$ORIGIN` control successfully converts and executes. The fixed test passes with `$ORIGIN`, `$ORIGIN/`, `$ORIGIN\`, `$ORIGIN/.` and `.`; all five generated consumers load the provider and exit 77. - Baseline binary built at `b42ef24e07725ba1166420073817d80a60ec9149`; current base `d06c06565717961104edecdab46ce61c8cc72a70` has identical relinker, build and tooling sources. The fixed build uses the current base. - Relinker-only Release build with `BUILD_TESTING=ON` and explicit `Python3_EXECUTABLE` succeeds; Python-backed `input_magic` is registered. - `ctest --test-dir build-relinker-origin-slash --output-on-failure -E 'conventions_function_bodies|conventions_wrapped_declarations|import_audit|pr_overlap_encoding' -j 4`: 119/119 pass in 18.02 seconds. The four excluded tooling tests create disposable Git commits and were not repeated under the personal commit quota; baseline Python tooling tests already passed 178 tests with two Windows symlink skips. - `git diff --check` passes. `python tools/check_conventions.py --base origin/main` passes on the submitted commit. This includes execution of generated Windows fixture executables and their provider. No game/title, GPU, Linux/macOS runtime or upstream CI validation is claimed. Reviewed the complete open-PR file inventory and the diffs/discussions of #3579, #3965, #3970 and #4062, which also edit Windows startup construction. None changes `normalizeRunPath` or addresses this failure. No dependency on those changes. 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 - [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) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) — no runtime exports changed - [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 — none added - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes — OpenAI Codex
github-actions[bot] commented 2026-10-12 15:36:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T15:36:18Z.


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.

Pull request Conflicting files (lines on main) Same exports Same new files
#4547 core/relinker/CMakeLists.txt L404
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6127483884 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4337#issuecomment-6127483884). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T15:36:18Z. --- <!-- pr-overlap --> 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**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #4547 | `core/relinker/CMakeLists.txt` [L404](https://github.com/boykopovar/AnyPS5/blob/d592d54e11ecce022abd62635a58bf2d048f3a2c/core/relinker/CMakeLists.txt#L404) | | |
ArjenS-LA commented 2026-10-12 15:39:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ArjenS-LA on 2026-10-12T15:39:28Z.


@codingreapermaps, I checked this PR against #4547 using Git's merge engine, normalizing both heads onto main d592d54e11ecce022abd62635a58bf2d048f3a2c and using that main as the explicit merge base.

At heads e2c24cf038b9bb5f200a666b2b5fedf2fdf10ff9 (#4337) and 0af8b55e8a2d3a37795234cf729ea50589c1aaa7 (#4547), both merge cleanly with main. Combining them conflicts only in core/relinker/CMakeLists.txt: windows_runpath and windows_trace_imports are inserted at the same location. The WindowsEntryStubBuilder.cpp changes merge cleanly; these fixes have no functional dependency.

Would #4337 merging first work for you, with both test registrations retained when #4547 is updated afterward? That would let #4547 record Depends on: #4337 for merge coordination alongside its existing #4546 dependency.

This is a tree-only merge preview and source inspection on Windows x64. I have not built or run the combined tree, and no code changes were pushed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6127537172 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4337#issuecomment-6127537172). Originally posted by [ArjenS-LA](https://github.com/ArjenS-LA) on 2026-10-12T15:39:28Z. --- @codingreapermaps, I checked this PR against #4547 using Git's merge engine, normalizing both heads onto main `d592d54e11ecce022abd62635a58bf2d048f3a2c` and using that main as the explicit merge base. At heads `e2c24cf038b9bb5f200a666b2b5fedf2fdf10ff9` (#4337) and `0af8b55e8a2d3a37795234cf729ea50589c1aaa7` (#4547), both merge cleanly with main. Combining them conflicts only in `core/relinker/CMakeLists.txt`: `windows_runpath` and `windows_trace_imports` are inserted at the same location. The `WindowsEntryStubBuilder.cpp` changes merge cleanly; these fixes have no functional dependency. Would #4337 merging first work for you, with both test registrations retained when #4547 is updated afterward? That would let #4547 record `Depends on: #4337` for merge coordination alongside its existing #4546 dependency. This is a tree-only merge preview and source inspection on Windows x64. I have not built or run the combined tree, and no code changes were pushed.
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!4337
No description provided.