Skip to content

fix: require exact Windows runfiles manifest matches - #1272

Merged
fmeum merged 1 commit into
bazel-contrib:mainfrom
alex-the-third:bugfix/windows-exact-manifest-matches
Jul 24, 2026
Merged

fmeum merged 1 commit into
bazel-contrib:mainfrom
alex-the-third:bugfix/windows-exact-manifest-matches

Conversation

@alex-the-third

Copy link
Copy Markdown
Contributor

Summary

Ensure Windows runfiles lookup resolves the exact manifest key instead of a later suffix-matching entry.

Fixes #1271

Problem

BATCH_RLOCATION_FUNCTION searches the runfiles manifest with:

findstr.exe /l /c:"!runfile_path! "

Because the search is not anchored, looking up repo/pkg/tool also matches a line beginning with other/repo/pkg/tool.

The loop processes every match, so a later suffix collision can overwrite the correct result. Generated Windows launchers may consequently execute or read the wrong runfile depending on manifest ordering.

Fix

Add findstr's /b option so the literal search must begin at the start of the manifest line:

findstr.exe /b /l /c:"!runfile_path! "

The change is otherwise limited to a Windows-only regression test that places an exact entry before a suffix-colliding entry and verifies that the exact payload is executed.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7bffff3004

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread lib/windows_utils.bzl
Comment thread lib/tests/windows_utils/exact_manifest_match_test.bzl
@fmeum
fmeum merged commit 1292cec into bazel-contrib:main Jul 24, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows runfiles lookup can resolve a suffix-matching manifest entry

2 participants