[6.2.0] Silence setlocale warnings in Java stub #17741
Merged
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.
Since 17cfa01, the java_stub_template.txt file calls into the locale tool to check for the presence of cetain locales. These calls correctly send error messages to stderr.
Unfortunately, bash itself is doing locale lookups as soon as it sees that the LANG or LC_* variables are touched, and this results in warnings that pollute the output. In our builds, the output is polluted with hundreds of warnings like these:
There is nothing we can do to avoid these warnings. Trying to set the LANG or LC_* variables via --action_env and --host_action_env has no effect (other than trigger more/different warnings).
The problem stems from https://bugzilla.redhat.com/show_bug.cgi?id=1361965, which has been fixed in various distros but hasn't made its way to the one we are currently using.
Given that it's bash that is complaining, we can easily side-step this issue by patching the template and wrapping the problematic invocations behind "env". In this way, bash never gets to see the locale changes. This change does precisely this.
Closes #17670.
PiperOrigin-RevId: 515350095
Change-Id: I1887003802aa329e7fb96f644a2fba906daf5165