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

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

From
Paul Eggert
Date:
‘zic -p’ is obsolescent and is incompatible with ‘zic -b slim’.
* src/tools/msvc/Install.pm (GenerateTimezoneFiles):
Omit use of zic’s -p option.
---
 src/tools/msvc/Install.pm | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm
index 9bf111c41e..31659fc299 100644
--- a/src/tools/msvc/Install.pm
+++ b/src/tools/msvc/Install.pm
@@ -366,16 +366,11 @@ sub GenerateTimezoneFiles
       || die "Could not find TZDATAFILES line in timezone makefile\n";
     my @tzfiles = split /\s+/, $1;

-    $mf =~ /^POSIXRULES\s*:?=\s*(.*)$/m
-      || die "Could not find POSIXRULES line in timezone makefile\n";
-    my $posixrules = $1;
-    $posixrules =~ s/\s+//g;
-
     print "Generating timezone files...";

     my @args = (
-        "$conf/zic/zic", '-d', "$target/share/timezone", '-p',
-        "$posixrules",   '-b', 'slim');
+        "$conf/zic/zic", '-d', "$target/share/timezone",
+        '-b', 'slim');
     foreach (@tzfiles)
     {
         my $tzfile = $_;
--
2.25.4




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

From
Tom Lane
Date:
Paul Eggert <eggert@cs.ucla.edu> writes:
> ‘zic -p’ is obsolescent and is incompatible with ‘zic -b slim’.

Hi Paul!

This is already under discussion, see

https://www.postgresql.org/message-id/flat/1390.1562258309%40sss.pgh.pa.us

although so far I haven't been able to convince everyone about how
fast we should move to adopt it.

We could use your knowledgeable input about

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

* what exactly is the incompatibility with -b slim?

            regards, tom lane



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

From
raf
Date:
Paul Eggert wrote:

> ‘zic -p’ is obsolescent and is incompatible with ‘zic -b slim’.
> * src/tools/msvc/Install.pm (GenerateTimezoneFiles):
> Omit use of zic’s -p option.
> ---
>  src/tools/msvc/Install.pm | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm
> index 9bf111c41e..31659fc299 100644
> --- a/src/tools/msvc/Install.pm
> +++ b/src/tools/msvc/Install.pm
> @@ -366,16 +366,11 @@ sub GenerateTimezoneFiles
>        || die "Could not find TZDATAFILES line in timezone makefile\n";
>      my @tzfiles = split /\s+/, $1;
>  
> -    $mf =~ /^POSIXRULES\s*:?=\s*(.*)$/m
> -      || die "Could not find POSIXRULES line in timezone makefile\n";
> -    my $posixrules = $1;
> -    $posixrules =~ s/\s+//g;
> -
>      print "Generating timezone files...";
>  
>      my @args = (
> -        "$conf/zic/zic", '-d', "$target/share/timezone", '-p',
> -        "$posixrules",   '-b', 'slim');
> +        "$conf/zic/zic", '-d', "$target/share/timezone",
> +        '-b', 'slim');
>      foreach (@tzfiles)
>      {
>          my $tzfile = $_;
> -- 
> 2.25.4

zic on Debian9 has a -p option but no -b option.
Will this change be a problem there?
Presumably it doesn't apply to Debian9
since -b slim was already there.

cheers,
raf




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

From
Paul Eggert
Date:
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.



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

From
Paul Eggert
Date:
raf wrote:

> zic on Debian9 has a -p option but no -b option.
> Will this change be a problem there?

No, as src/tools/msvc/Install.pm already uses 'zic -b slim'.