Skip to content

fix(windows): prefer the manifest over the sparse runfiles directory - #64

Merged
malt3 merged 1 commit into
mainfrom
malt3/windows-pr59-bug
Jul 18, 2026
Merged

fix(windows): prefer the manifest over the sparse runfiles directory#64
malt3 merged 1 commit into
mainfrom
malt3/windows-pr59-bug

Conversation

@malt3

@malt3 malt3 commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

PR #59 changed runfiles source selection to prefer a directory over a manifest at equal precedence. On Windows, Bazel does not materialize the runfiles symlink tree by default, so a sibling <exe>.runfiles / RUNFILES_DIR exists but is sparse and only the manifest maps runfiles to real paths. Directory-first selection there resolves rlocations to files that do not exist, so the launcher fails to start its target (and drops RUNFILES_MANIFEST_FILE from the child environment). On Linux/macOS the tree is materialized, so the directory is fully populated and directory-first is correct.

Gate the within-tier directory-vs-manifest preference on a per-backend PREFER_DIRECTORY_SOURCE constant (true on Linux/macOS, false on Windows), consumed by a new select_source helper in runfiles.rs. The environment-over-adjacent tiering is unchanged; only Windows reverts to the pre-#59 manifest-first order.

Update test_runfiles_source_precedence to assert the platform-correct winner and to cover a sparse-directory no-fallthrough case per platform, and document the Windows exception in the README.

PR #59 changed runfiles source selection to prefer a directory over a
manifest at equal precedence. On Windows, Bazel does not materialize the
runfiles symlink tree by default, so a sibling `<exe>.runfiles` / `RUNFILES_DIR`
exists but is sparse and only the manifest maps runfiles to real paths.
Directory-first selection there resolves rlocations to files that do not
exist, so the launcher fails to start its target (and drops
RUNFILES_MANIFEST_FILE from the child environment). On Linux/macOS the tree
is materialized, so the directory is fully populated and directory-first is
correct.

Gate the within-tier directory-vs-manifest preference on a per-backend
`PREFER_DIRECTORY_SOURCE` constant (true on Linux/macOS, false on Windows),
consumed by a new `select_source` helper in runfiles.rs. The
environment-over-adjacent tiering is unchanged; only Windows reverts to the
pre-#59 manifest-first order.

Update `test_runfiles_source_precedence` to assert the platform-correct
winner and to cover a sparse-directory no-fallthrough case per platform, and
document the Windows exception in the README.
@github-actions

Copy link
Copy Markdown

Binary Size Report

Comparing eabda274 (base) → 66201d0a (PR)

Binary Base PR Change
finalize-stub-aarch64-linux 2.97 MiB 2.97 MiB
finalize-stub-aarch64-macos 2.64 MiB 2.64 MiB
finalize-stub-aarch64-windows.exe 2.72 MiB 2.72 MiB
finalize-stub-s390x-linux 3.03 MiB 3.03 MiB
finalize-stub-x86_64-linux 3.52 MiB 3.52 MiB
finalize-stub-x86_64-macos 3.07 MiB 3.07 MiB
finalize-stub-x86_64-windows.exe 3.10 MiB 3.10 MiB
runfiles-stub-aarch64-linux 16.0 KiB 16.2 KiB +256 B (+1.56%)
runfiles-stub-aarch64-macos 16.6 KiB 16.6 KiB +16 B (+0.09%)
runfiles-stub-aarch64-windows.exe 27.0 KiB 27.0 KiB
runfiles-stub-s390x-linux 22.1 KiB 21.3 KiB -848 B (-3.74%)
runfiles-stub-x86_64-linux 16.8 KiB 17.1 KiB +288 B (+1.68%)
runfiles-stub-x86_64-macos 16.2 KiB 16.2 KiB
runfiles-stub-x86_64-windows.exe 28.0 KiB 28.0 KiB

Total: 21.19 MiB → 21.19 MiB (-288 B (-0.00%))

@malt3
malt3 merged commit 3672077 into main Jul 18, 2026
12 checks passed
@malt3
malt3 deleted the malt3/windows-pr59-bug branch July 18, 2026 13:20
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.

1 participant