[PATCH] Fix bug in last time type of Asia/Gaza etc.
* zic.c (outzone): When avoiding bloat due to transitions deducible from the TZ string, don’t eliminate transitions that are before any lower-bound cutoff established by -r. All but the last of these transitions will be discarded later by limitrange, and the last transition is needed so that the dummy time type after the TZif file’s last transition agrees with the TZ string as required by Internet RFC 8536 section 3.3. This problem can be observed in tzdb 2021a if you run the command ‘zic -r@2145916800 asia’: the output file Asia/Gaza’s only time transition, which is at the specified time 2038-01-01 00:00:00 UTC, has an associated time type that specifies +03 with DST, rather than the correct +02 without DST. --- NEWS | 6 ++++++ zic.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index b9d5777..a22e8ff 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,12 @@ Unreleased, experimental changes Portugal observed DST in 1950. (Thanks to Alois Treindl.) + Changes to code + + Fix bug in zic -r; in some cases, the dummy time type after the + last time transition disagreed with the TZ string, contrary to + Internet RFC 8563 section 3.3. + Release 2021a - 2021-01-24 10:54:57 -0800 diff --git a/zic.c b/zic.c index a902b34..a864bc4 100644 --- a/zic.c +++ b/zic.c @@ -2715,6 +2715,7 @@ outzone(const struct zone *zpfirst, ptrdiff_t zonecount) for (i = 0; i < zonecount; ++i) { struct rule *prevrp = NULL; + zic_t prevktime = min_time; /* ** A guess that may well be corrected later. */ @@ -2851,7 +2852,7 @@ outzone(const struct zone *zpfirst, ptrdiff_t zonecount) rp->r_isdst, rp->r_save, false); offset = oadd(zp->z_stdoff, rp->r_save); if (!want_bloat() && !useuntil && !do_extend - && prevrp + && prevrp && lo_time <= prevktime && rp->r_hiyear == ZIC_MAX && prevrp->r_hiyear == ZIC_MAX) break; @@ -2865,6 +2866,7 @@ outzone(const struct zone *zpfirst, ptrdiff_t zonecount) lastatmax = timecnt; addtt(ktime, type); prevrp = rp; + prevktime = ktime; } } if (usestart) { -- 2.27.0
participants (1)
-
Paul Eggert