Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Analysis
Looking at your logs, the askama hypothesis is wrong — only 2 of 14 affected targets use askama. The real issue:
All 25 non-deterministic artifacts are .rlib files (Rust library archives). Each .rlib contains a .rmeta section where rustc embeds:
Absolute paths to source files
Absolute paths to dependency .rlib files in bazel-out/...
What's happening inside the .rlib file
Each .rlib is an ar archive containing:
The .rmeta section contains:
Root cause
Between your two builds (cache vs nocache), even though they produce outputs at the same relative path like bazel-out/k8-opt-ST-6bd88323ee24/bin/..., the absolute execution root path differs:
Build 1 (cache): /some/path/.cache/bazel/_bazel_runner/hash1/execroot/ic/bazel-out/k8-opt-ST-6bd88323ee24/bin/...
Build 2 (nocache): /different/path/.cache/bazel/_bazel_runner/hash2/execroot/ic/bazel-out/k8-opt-ST-6bd88323ee24/bin/...
These absolute paths get embedded in the .rmeta. Even though the relative structure (bazel-out/k8-opt-ST-6bd88323ee24/...) is identical, the full paths rustc embeds are different, causing different file contents → different SHA256.
Fix
The -Cremap-path-prefix=/proc/self/cwd=. strips the varying /some/path/.cache/bazel/_bazel_runner/hash/execroot/ic/ prefix, replacing it with ., so all builds produce identical .rmeta regardless of where the Bazel cache lives.