Re: [PATCH] Stop using zic’s -p option.

From: Paul Eggert <eggert(at)cs(dot)ucla(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Stop using zic’s -p option.
Date: 2020-06-22 03:32:59
Message-ID: 9d8b5ec4-7094-04f6-d270-db0198d09bd1@cs.ucla.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 6/21/20 5:40 PM, Tom Lane wrote:

> * how quickly do you think that the "posixrules" file is likely
> to disappear in major distros, such as Debian, RHEL, macOS?

Probably NetBSD will go first as they tend to buy these changes quickly; maybe
six months from now? Debian and RHEL probably a couple of years. These are all
just guesses.

> * what exactly is the incompatibility with -b slim?

The problem occurs only when the -p option would make a difference, i.e., with
odd TZ settings like TZ='AST4ADT' that neither conform to POSIX (because they
specify DST but lack transition info) nor correspond to a TZif file. In this
case, the tzcode library mostly follows POSIX but fills in transition info from
the transitions in the posixrules file.

If the posixrules file was generated via '-b fat', this process fails for some
post-2037 timestamps in the tzcode implementation, and it fails for some current
timestamps in current glibc. Here's an example of a glibc failure for this
year's timestamps using tzdb (any tzdb version from 2005m through 2020a):

$ zdump -V -c2020,2021 AST4ADT
AST4ADT Sun Mar 8 07:59:59 2020 UT = Sun Mar 8 03:59:59 2020 AST isdst=0
gmtoff=-14400
AST4ADT Sun Mar 8 08:00:00 2020 UT = Sun Mar 8 05:00:00 2020 ADT isdst=1
gmtoff=-10800
AST4ADT Sun Nov 1 06:59:59 2020 UT = Sun Nov 1 03:59:59 2020 ADT isdst=1
gmtoff=-10800
AST4ADT Sun Nov 1 07:00:00 2020 UT = Sun Nov 1 03:00:00 2020 AST isdst=0
gmtoff=-14400

Those transitions are incorrect, since the spring-forward and fall-back times
should be 02:00, not 04:00.

If the posixrules file was generated via '-b slim', some of the necessary
posixrules information is absent (since this stuff is optional and it's not
needed except for the odd TZ settings), and so the posixrules calculations might
go awry in a different way. As it happens, with -b slim the above example works
correctly with glibc, but there are other cases where it fails in a different
way, using posixrules settings that pretty much nobody uses in practice (e.g.,
posixrules an alias for Europe/Paris and someone sets TZ='EET-2EEST'.)

Nobody should be using odd TZ settings like 'AST4ADT' or 'EET-2EEST' anyway
(because they don't work even with fat TZif files), so this stuff shouldn't
matter in real life.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2020-06-22 15:49:40 Re: BUG #16502: EXPLAIN JSON format adds extra quotes around index names
Previous Message raf 2020-06-22 02:38:21 Re: [PATCH] Stop using zic’s -p option.