On Wed, 1 Sep 2021 06:45:26 GMT, Wu Yan <wu...@openjdk.org> wrote: > 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
This pull request has now been integrated. Changeset: 88bbf3c2 Author: Wu Yan <wu...@openjdk.org> Committer: Naoto Sato <na...@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/88bbf3c2e6ac9f6d88cbb361cfbb4c16bb8eafc1 Stats: 352 lines in 4 files changed: 203 ins; 145 del; 4 mod 8273111: Default timezone should return zone ID if /etc/localtime is valid but not canonicalization on linux Co-authored-by: Sun Jianye <sunjia...@huawei.com> Reviewed-by: naoto, mli ------------- PR: https://git.openjdk.java.net/jdk/pull/5327