RFR: 8375045: Incorrect Interpretation of POSIX TZ Environment Variable on AIX.
Naoto Sato
naoto at openjdk.org
Fri Feb 27 18:48:21 UTC 2026
On Tue, 13 Jan 2026 06:26:02 GMT, Sruthy Jayan <duke at openjdk.org> wrote:
> Bug Reference : https://bugs.openjdk.org/browse/JDK-8375045
>
> On AIX, the POSIX TZ environment variable is not interpreted as expected when it includes DST rules.
> Example: `TZ=CET-1CEST,M3.5.0,M10.5.0`
>
> The fix includes :
> The TZ environment variable is processed by first matching the full value against tzmappings, then retrying with the value truncated at the first comma if no match is found, and finally defaulting to GMT if no mapping exists.
>
> This fixes the regression caused by https://bugs.openjdk.org/browse/JDK-8292899
>
> Signed-off-by: Sruthy Jayan <srutjay1 at in.ibm.com>
I don't have any knowledge on AIX's TZ mappings, so I just left generic comments.
src/java.base/unix/native/libjava/TimeZone_md.c line 355:
> 353:
> 354: static char *
> 355: mapTimezoneToJava(const char *tz_buf, size_t tz_len, const char *mapfilename) {
This function name is kind of vague as to what it actually does. More specific name would be preferred.
src/java.base/unix/native/libjava/TimeZone_md.c line 451:
> 449: temp_tz = strchr(tz, ',');
> 450: tz_len = (temp_tz == NULL) ? strlen(tz) : temp_tz - tz;
> 451: tz_buf = (char *)malloc(tz_len + 1);
Is this malloc needed? Is `tz_buf` already allocated by the above `strdup` with full length? If for some reason it needs to reallocate a new buffer, previously allocated buffer needs to be freed.
-------------
PR Review: https://git.openjdk.org/jdk/pull/29183#pullrequestreview-3868469696
PR Review Comment: https://git.openjdk.org/jdk/pull/29183#discussion_r2865687106
PR Review Comment: https://git.openjdk.org/jdk/pull/29183#discussion_r2865692828
More information about the core-libs-dev
mailing list