From a3b8e314992085203307f8de4d97f325a3274ba9 Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 8 Oct 2024 10:21:38 -0700 Subject: [PATCH] Automated rollback of commit d2f19710b574a76206c7499d746e7c9f7e733e99. *** Reason for rollback *** This regressed support for non-ASCII characters in paths on systems that don't support C.UTF-8, see b/372094587 *** Original change description *** Use `C.UTF-8` instead of `en_US.UTF-8` locale for Java compilation `C.UTF-8` is now the universally accepted standard UTF-8 locale, to the point where some minimal distributions no longer ship with `en_US.UTF-8` (e.g. RHEL 9 with `glibc-minimal`). CentOS 7, the only major distribution that doesn't have the locale, is EOL now. Note that the locale can't be detected automatically since the action may run on a machine that isn't the host.... *** PiperOrigin-RevId: 683672854 Change-Id: I6c1d4fe43066c068db345987f54388c6fcdd0539 --- .../build/lib/rules/java/JavaCompileActionBuilder.java | 2 +- .../build/lib/rules/java/JavaCompileActionBuilderTest.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilder.java index 2dc63f25b7ab24..f27ec299aa0675 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilder.java @@ -53,7 +53,7 @@ public final class JavaCompileActionBuilder { /** Environment variable that sets the UTF-8 charset. */ static final ImmutableMap UTF8_ENVIRONMENT = - ImmutableMap.of("LC_CTYPE", "C.UTF-8"); + ImmutableMap.of("LC_CTYPE", "en_US.UTF-8"); static final String MNEMONIC = "Javac"; diff --git a/src/test/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilderTest.java b/src/test/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilderTest.java index 5a35b01a447475..c374d1e05ba1e7 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilderTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilderTest.java @@ -150,7 +150,8 @@ public void testLocale() throws Exception { """); JavaCompileAction action = (JavaCompileAction) getGeneratingActionForLabel("//java/com/google/test:liba.jar"); - assertThat(action.getIncompleteEnvironmentForTesting()).containsEntry("LC_CTYPE", "C.UTF-8"); + assertThat(action.getIncompleteEnvironmentForTesting()) + .containsEntry("LC_CTYPE", "en_US.UTF-8"); } @Test