>From 23c040804f937df7d341383743baf16b81454ed7 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 20 May 2019 12:59:50 -0700
Subject: [PROPOSED 2/2] zic: remove horrid special case for 2037

* NEWS: Mention this.
* zic.c (YEAR_BY_YEAR_ZONE): Remove.  All uses removed.
(stringzone): Remove "horrid special case" for 2037.
The current data no longer rely on it, and it caused problems
on newlib with the previous data.
---
 NEWS  |  9 +++++++++
 zic.c | 14 ++------------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/NEWS b/NEWS
index 5caaf9b..f2c5965 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,15 @@ Unreleased, experimental changes
     Europe/Rome between those dates.  (Thanks to Stephen Trainor and
     Luigi Rosa.)
 
+  Changes to code
+
+    zic no longer treats a set of rules ending in 2037 specially.
+    Previously, zic assumed that such a ruleset meant that future
+    timestamps could not be predicted, and therefore omitted a
+    POSIX-like TZ string in the TZif output.  The old behavior is no
+    longer needed for current tzdata, and caused problems with newlib
+    when used with older tzdata (reported by David Gauchard).
+
   Changes to build procedure
 
     tzdata.zi now assumes zic 2017c or later.  This shrinks tzdata.zi
diff --git a/zic.c b/zic.c
index 5b932dc..2cd8cc7 100644
--- a/zic.c
+++ b/zic.c
@@ -2396,8 +2396,6 @@ rule_cmp(struct rule const *a, struct rule const *b)
 	return a->r_dayofmonth - b->r_dayofmonth;
 }
 
-enum { YEAR_BY_YEAR_ZONE = 1 };
-
 static int
 stringzone(char *result, struct zone const *zpfirst, ptrdiff_t zonecount)
 {
@@ -2452,14 +2450,6 @@ stringzone(char *result, struct zone const *zpfirst, ptrdiff_t zonecount)
 			if (rule_cmp(stdrp, rp) < 0)
 				stdrp = rp;
 		}
-		/*
-		** Horrid special case: if year is 2037,
-		** presume this is a zone handled on a year-by-year basis;
-		** do not try to apply a rule to the zone.
-		*/
-		if (stdrp != NULL && stdrp->r_hiyear == 2037)
-			return YEAR_BY_YEAR_ZONE;
-
 		if (stdrp != NULL && stdrp->r_isdst) {
 			/* Perpetual DST.  */
 			dstr.r_month = TM_JANUARY;
@@ -2600,13 +2590,13 @@ outzone(const struct zone *zpfirst, ptrdiff_t zonecount)
 	*/
 	compat = stringzone(envvar, zpfirst, zonecount);
 	version = compat < 2013 ? ZIC_VERSION_PRE_2013 : ZIC_VERSION;
-	do_extend = compat < 0 || compat == YEAR_BY_YEAR_ZONE;
+	do_extend = compat < 0;
 	if (noise) {
 		if (!*envvar)
 			warning("%s %s",
 				_("no POSIX environment variable for zone"),
 				zpfirst->z_name);
-		else if (compat != 0 && compat != YEAR_BY_YEAR_ZONE) {
+		else if (compat != 0) {
 			/* Circa-COMPAT clients, and earlier clients, might
 			   not work for this zone when given dates before
 			   1970 or after 2038.  */
-- 
2.21.0

