Merged
Conversation
fmeum
approved these changes
Aug 27, 2025
fmeum
reviewed
Aug 27, 2025
There were multiple problems with trim paths: - The trim path was inconsistent between non-cgo and cgo. non-cgo trimmed the working directory, and cgo trimmed the parent of the working directory. - For non-cgo, paths in external repos are not trimmed when --experimental_sibling_repository_layout is enabled. - For cgo, the name of the working directory is included in the output, but this name is not consistent between local and remote builds, breaking reproducibility. These are fixed here by creating the trim path in the same way for both non-cgo and cgo, and trimming the working directory as well as replacing the parent of the working directory with `..`. This means that the resulting paths are relative to the working directory. Additionally, this fixes the existing feature to extend an existing trimpath. It used the wrong separator (`:` instead of `;`), and it applied `abs()` to the entire trimpath argument instead of the individual paths inside it. Fixes: bazel-contrib#4434 Fixes: bazel-contrib#4161
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.
What type of PR is this?
Bug fix
What does this PR do? Why is it needed?
There were multiple problems with trim paths:
These are fixed here by creating the trim path in the same way for both non-cgo and cgo, and trimming the working directory as well as replacing the parent of the working directory with
... This means that the resulting paths are relative to the working directory.Additionally, this fixes the existing feature to extend an existing trimpath. It used the wrong separator (
:instead of;), and it appliedabs()to the entire trimpath argument instead of the individual paths inside it. (See #2994 (comment) and #2994 (comment))Which issues(s) does this PR fix?
Fixes: #4434
Fixes: #4161