-
-
Notifications
You must be signed in to change notification settings - Fork 643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix issue with duplicated BinaryPath
instances passed to BinaryShimsRequest
#21745
fix issue with duplicated BinaryPath
instances passed to BinaryShimsRequest
#21745
Conversation
Could we have a test for this? |
Added tests. Also added detection of duplicate paths where the content hashes differ (which results in unequal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to merge (question doesn't block it).
for path, group in groupby(paths, key=lambda x: x.path): | ||
if len(list(group)) > 1: | ||
duplicate_paths.add(path) | ||
if duplicate_paths: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, how can two files listed under the same path have different content, on a single machine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given how BinaryPaths
are produced, they wouldn't ever have different content hashes, assuming they were generated correctly. This is me just protecting against an edge case if somehow rule logic decided to mix BinaryPath
instances in some weird way.
The test failure seems flaky. Fix in #21756. |
0b300ca
to
ef3df7f
Compare
I tried to automatically cherry-pick this change back to each relevant milestone, so that it is available in those older releases of Pants. ❌ 2.23.xI was unable to cherry-pick this PR to 2.23.x, likely due to merge-conflicts. Steps to Cherry-Pick locallyTo resolve:
Please note that I cannot re-run CI if a job fails. Please work with your PR approver(s) to re-run CI if necessary. ✔️ 2.24.xSuccessfully opened #21758. When you're done manually cherry-picking, please remove the Thanks again for your contributions! |
…msRequest` (#21745) As reported in #21709, a Docker tool appearing in both the `--docker-tools` and `--docker-optional-tools` options was causing an error with the `create_digest` intrinsic: `Snapshots must be constructed from unique path stats; got duplicates in [Some("docker-credential-ecr-login"), Some("getent"), Some("sw_vers")]` The root cause is that duplicate `BinaryPath` instances were being passed to `BinaryShimsRequest.for_paths` which was then translated eventually into a `create_digest` call with the duplicate paths (which is not permitted). Solution: De-duplicate paths in `BinaryShimsRequest.for_paths` (and sort into stable order for good measure to ensure better cacheability). Closes #21709. --------- Co-authored-by: Tom Dyas <[email protected]>
Manually cherry picked to |
…msRequest` (Cherry-pick of #21745) (#21758) As reported in #21709, a Docker tool appearing in both the `--docker-tools` and `--docker-optional-tools` options was causing an error with the `create_digest` intrinsic: `Snapshots must be constructed from unique path stats; got duplicates in [Some("docker-credential-ecr-login"), Some("getent"), Some("sw_vers")]` The root cause is that duplicate `BinaryPath` instances were being passed to `BinaryShimsRequest.for_paths` which was then translated eventually into a `create_digest` call with the duplicate paths (which is not permitted). Solution: De-duplicate paths in `BinaryShimsRequest.for_paths` (and sort into stable order for good measure to ensure better cacheability). Co-authored-by: Tom Dyas <[email protected]> Co-authored-by: Tom Dyas <[email protected]>
…msRequest` (Cherry pick of #21745) (#21759) As reported in #21709, a Docker tool appearing in both the `--docker-tools` and `--docker-optional-tools` options was causing an error with the `create_digest` intrinsic: `Snapshots must be constructed from unique path stats; got duplicates in [Some("docker-credential-ecr-login"), Some("getent"), Some("sw_vers")]` The root cause is that duplicate `BinaryPath` instances were being passed to `BinaryShimsRequest.for_paths` which was then translated eventually into a `create_digest` call with the duplicate paths (which is not permitted). Solution: De-duplicate paths in `BinaryShimsRequest.for_paths` (and sort into stable order for good measure to ensure better cacheability). Closes #21709. --------- Co-authored-by: Tom Dyas <[email protected]>
As reported in #21709, a Docker tool appearing in both the
--docker-tools
and--docker-optional-tools
options was causing an error with thecreate_digest
intrinsic:Snapshots must be constructed from unique path stats; got duplicates in [Some("docker-credential-ecr-login"), Some("getent"), Some("sw_vers")]
The root cause is that duplicate
BinaryPath
instances were being passed toBinaryShimsRequest.for_paths
which was then translated eventually into acreate_digest
call with the duplicate paths (which is not permitted).Solution: De-duplicate paths in
BinaryShimsRequest.for_paths
(and sort into stable order for good measure to ensure better cacheability).Closes #21709.