RFR: 8255239: The timezone of the hs_err_pid log file is corrupted in Japanese locale
Ioi Lam
iklam at openjdk.java.net
Tue Nov 3 15:32:04 UTC 2020
On Mon, 2 Nov 2020 23:59:30 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:
> Please review this simple fix by using the wide char version of strftime, i.e. wcsftime, to convert the timezone into a wide character string. After that, converting the wide character string back to multi-byte string before printing out the time and timezone.
>
> Testing: ran the test case in the bug report manually on:
>
> - Windows with ja, zh-tw, and en locales;
>
> - Linux and Mac OS with en locale.
Changes requested by iklam (Reviewer).
src/hotspot/share/runtime/os.cpp line 1006:
> 1004: if (localtime_pd(&tloc, &tz) != NULL) {
> 1005: wchar_t w_buf[80];
> 1006: size_t n = ::wcsftime(w_buf, 80, L"%Z", &tz);
According to https://linux.die.net/man/3/wcsftime: "The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux."
Also, the L"%Z" notation is Windows-specific.
Maybe we should use the new code only on Windows?
An alternative is to use the C++ standard library (std::wcsftime and std:: wcstombs). However, this part of std:: is not yet permitted -- see https://bugs.openjdk.java.net/browse/JDK-8208089
-------------
PR: https://git.openjdk.java.net/jdk/pull/1023
More information about the hotspot-runtime-dev
mailing list