Skip to content

Patcher for AWS SDKv2 locale-dependent formatting #126326

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

Merged
merged 10 commits into from
Apr 15, 2025

Conversation

ldematte
Copy link
Contributor

@ldematte ldematte commented Apr 4, 2025

AWS SDK v2 has a bug (aws/aws-sdk-java-v2#5968) where PathResolver uses locale-dependent formatting.

This PR adds a patcher to the discovery-ec2 build process to replace calls to String.format(<format>, <args>) with String.format(Locale.ROOT, <format>, <args>).

Relates to ES-11279

@ldematte ldematte added >non-issue :Core/Infra/Core Core issues without another label labels Apr 7, 2025
@ldematte ldematte marked this pull request as ready for review April 7, 2025 13:35
@ldematte ldematte requested a review from a team as a code owner April 7, 2025 13:35
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Apr 7, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@ldematte ldematte requested review from DaveCTurner and a team April 7, 2025 13:36
Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

Can we revert the test change in 23769da to show that this fixes the actual bug?

ldematte added a commit that referenced this pull request Apr 11, 2025
Patchers transform specific classes in some "broken" dependencies to ensure they behave correctly (fixing a bug, disabling some undesired or dangerous behaviour, updating calls to deprecated or removed method overloads).

If we upgrade one of the dependencies we patch, we have a concerns that the patchers may not work against the classes in the new version.
This PR addresses this concern by introducing a check on the SHA256 digest of the class, to ensure we are operating on the same bytes the patcher was designed for; if the digest changes that means the class has been changed (e.g. for a dependency update). If that happens, we break the build process with a specific error, so we can double check that the patchers still work against the new classes.

Extracted from #126326

Relates to ES-11279
@ldematte ldematte requested a review from DaveCTurner April 14, 2025 13:04
Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

LGTM (assuming CI is happy)

@ldematte ldematte enabled auto-merge (squash) April 14, 2025 14:02
@ldematte ldematte merged commit 2697a3a into elastic:main Apr 15, 2025
17 checks passed
@ldematte ldematte deleted the awssdkv2-string-format-patcher branch April 15, 2025 12:15
afoucret pushed a commit to afoucret/elasticsearch that referenced this pull request Apr 16, 2025
AWS SDK v2 has a bug (aws/aws-sdk-java-v2#5968) where PathResolver uses locale-dependent formatting.

This PR adds a patcher to the discovery-ec2 build process to replace calls to String.format(<format>, <args>) with String.format(Locale.ROOT, <format>, <args>).

Relates to ES-11279
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >non-issue Team:Core/Infra Meta label for core/infra team v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants