Re: [Tzdist-bis] Leap Second Support Interval Field Request - RFC8536

Paul Eggert <eggert@cs.ucla.edu> Wed, 15 January 2020 02:51 UTC

Return-Path: <eggert@cs.ucla.edu>
X-Original-To: tzdist-bis@ietfa.amsl.com
Delivered-To: tzdist-bis@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id A4907120889; Tue, 14 Jan 2020 18:51:55 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.2
X-Spam-Level:
X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9OLGLNY-wBS0; Tue, 14 Jan 2020 18:51:53 -0800 (PST)
Received: from zimbra.cs.ucla.edu (zimbra.cs.ucla.edu [131.179.128.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id BA231120831; Tue, 14 Jan 2020 18:51:53 -0800 (PST)
Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 00D331600AB; Tue, 14 Jan 2020 18:51:53 -0800 (PST)
Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id orN22waCGWhb; Tue, 14 Jan 2020 18:51:52 -0800 (PST)
Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id EA47C1600B3; Tue, 14 Jan 2020 18:51:51 -0800 (PST)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 46LifUrBRZI3; Tue, 14 Jan 2020 18:51:51 -0800 (PST)
Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id C89211600AB; Tue, 14 Jan 2020 18:51:51 -0800 (PST)
From: Paul Eggert <eggert@cs.ucla.edu>
To: Michael Veth <michael.veth@vethresearch.com>
Cc: arthurdavidolson@gmail.com, iesg@ietf.org, howard.hinnant@gmail.com, Don Venable <donald.venable@vethresearch.com>, Time Zone Mailing List <tz@iana.org>, Extensions to Time Zone Data Distribution Service <tzdist-bis@ietf.org>
References: <CAM6iTuYo8wPk88XiNhiPF1_7oHEkRUpyiwJa8-g8E9teR9cZcw@mail.gmail.com> <07ffd02d-ab8b-4d9f-ab27-dd6b0691e039@cs.ucla.edu>
Organization: UCLA Computer Science Department
Message-ID: <96cf8968-5e59-7a0e-658c-1e1227924a53@cs.ucla.edu>
Date: Tue, 14 Jan 2020 18:51:48 -0800
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1
MIME-Version: 1.0
In-Reply-To: <07ffd02d-ab8b-4d9f-ab27-dd6b0691e039@cs.ucla.edu>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/tzdist-bis/E3CTdxHPtrW8rsSjYdZ4o9Ho_ew>
Subject: Re: [Tzdist-bis] Leap Second Support Interval Field Request - RFC8536
X-BeenThere: tzdist-bis@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Extensions to Time Zone Data Distribution Service <tzdist-bis.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tzdist-bis>, <mailto:tzdist-bis-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tzdist-bis/>
List-Post: <mailto:tzdist-bis@ietf.org>
List-Help: <mailto:tzdist-bis-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tzdist-bis>, <mailto:tzdist-bis-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 15 Jan 2020 02:51:56 -0000

On 12/5/19 8:34 PM, I wrote:

> The TZif file format does provide for truncated files (see Internet RFC 
> 8536 section 5.1), and one can generate files truncated to the current 
> UTC expiration time (2020-06-28 00:00:00 UTC) with a command like this:
> 
> zic -r /@1593302427 -L leapseconds tzdata.zi
> 
> However, it's awkward that one must count the number of seconds since 
> 1970-01-01 00:00:00 UTC (including leap seconds) by hand to get the 
> numeric timestamp (1593302427 in this case) to pass to zic. We could add 
> support to zic to do this sort of thing in a more-natural way.


When I looked into this issue, I found a significant bug tzdb's client 
code: when a TZif file has leap seconds, localtime mishandles 
daylight-saving transitions after the file's last transition time (which 
is typically in the year 2037). Today I proposed a fix for this tzcode bug:

https://mm.icann.org/pipermail/tz/2020-January/028792.html

However, similar bugs occur in other clients, such as the GNU C Library. 
Although I plan to file a bug report against glibc, I imagine it'll take 
some time to propagate fixes into this and other libraries.

As luck would have it, one workaround for the bug is to truncate TZif 
files along the lines suggested above, as this "fixes" old clients by 
removing problematic combinations of leap seconds and DST transitions 
from TZif files. So I implemented the above-quoted suggestion in a patch 
I proposed today:

https://mm.icann.org/pipermail/tz/2020-January/028793.html

This patch causes zic to truncate the end of an output TZif file 
containing leap seconds, using the leapseconds file's expiration date. 
The truncation is as per Internet RFC 8536 section 5.1.

Although it will take some time for these patches to propagate to 
operating system distributions and TZDIST servers, the patches should 
provide a way to move forward and with luck the Y2038 leap second bug 
should be mostly fixed before the year 2038 rolls around. Plus, TZDIST 
clients should be able to determine the leap second expiration date by 
examining the truncated TZif files.

None of these changes should affect the typical case of TZif files that 
omit leap seconds.