RFR: 8273111: Default timezone should return zone ID if /etc/localtime is valid but not canonicalization on linux [v2]

Wu Yan wuyan at openjdk.java.net
Thu Sep 9 08:25:44 UTC 2021

> Hi,
> Please help me review the change to enhance getting  time zone ID from /etc/localtime on linux.
> We use `realpath` instead of `readlink` to obtain the link name of /etc/localtime, because `readlink` can only read the value of a symbolic of link, not the canonicalized absolute pathname.
> For example, the value of /etc/localtime is "../usr/share/zoneinfo//Asia/Shanghai", then the linkbuf obtained by `readlink` is "../usr/share/zoneinfo//Asia/Shanghai", and then the call of `getZoneName(linkbuf)` will get "/Asia/Shanghai", not "Asia/Shanghai", which consider as invalid in `ZoneInfoFile.getZoneInfo()`. Using `realpath`, you can get “/usr/share/zoneinfo/Asia/Shanghai“ directly from “/etc/localtime“.
> Thanks,
> wuyan

Wu Yan has updated the pull request incrementally with one additional commit since the last revision:

  replace realpath


  - all: https://git.openjdk.java.net/jdk/pull/5327/files
  - new: https://git.openjdk.java.net/jdk/pull/5327/files/9b29edfc..19cc634d

 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5327&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5327&range=00-01

  Stats: 395 lines in 4 files changed: 241 ins; 145 del; 9 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5327.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5327/head:pull/5327

PR: https://git.openjdk.java.net/jdk/pull/5327

More information about the core-libs-dev mailing list