Skip to content

Commit 3ad3927

Browse files
fmeumcopybara-github
authored andcommitted
Force the Bazel server Java runtime to use the root locale
This ensures consistent behavior of string operations even if the individual operations do not set a locale. Without this change, Bazel can't operate in e.g. a Turkish locale, where it fails with error messages such as: In rule 'test', size 'medium' is not a valid size. This is because Turkish case mapping rules make it so that a capital ASCII 'I' lowercases to a non-ASCII variant of 'i'. Fixes bazelbuild#17541 Closes bazelbuild#17702. PiperOrigin-RevId: 515339563 Change-Id: I8417d0befd76ba6d140588be5f7e50529af3f6c7
1 parent 488ab8a commit 3ad3927

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main/cpp/blaze.cc

+7
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,13 @@ static vector<string> GetServerExeArgs(const blaze_util::Path &jvm_path,
402402

403403
// Force use of latin1 for file names.
404404
result.push_back("-Dfile.encoding=ISO-8859-1");
405+
// Force into the root locale to ensure consistent behavior of string
406+
// operations across machines (e.g. in the tr_TR locale, capital ASCII 'I'
407+
// turns into a special Unicode 'i' when converted to lower case).
408+
// https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Locale.html#ROOT
409+
result.push_back("-Duser.country=");
410+
result.push_back("-Duser.language=");
411+
result.push_back("-Duser.variant=");
405412

406413
if (startup_options.host_jvm_debug) {
407414
BAZEL_LOG(USER)

0 commit comments

Comments
 (0)