public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] time: Remove assert in reading of tz file
@ 2021-12-06 14:50 Christopher Wong
  2021-12-06 15:10 ` Florian Weimer
  0 siblings, 1 reply; 18+ messages in thread
From: Christopher Wong @ 2021-12-06 14:50 UTC (permalink / raw)
  To: libc-alpha

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-time-Remove-assert-in-reading-of-tz-file.patch --]
[-- Type: text/x-patch; name="0001-time-Remove-assert-in-reading-of-tz-file.patch", Size: 1393 bytes --]

From d1f0f7a09765ce7bb80d7d6bdd00e39bf7ca5d54 Mon Sep 17 00:00:00 2001
From: Christopher Wong <christopher.wong@axis.com>
Date: Mon, 6 Dec 2021 14:48:33 +0100
Subject: [PATCH] time: Remove assert in reading of tz file
To: libc-alpha@sourceware.org

The assumption of "__tzname[0] == NULL" then there must be no transition
and "num_types == 1" is obsolete. The case when the tz file is truncated
then "__tzname[0] == NULL" happens even when there is one transition.

The "num_types == 1" is kept up to version 2021c of the tzdb. Starting
from version 2021d of the tzdb the truncation introduces "-00" time zone
abbreviations for intervals with Universal Time (UT) offsets that are
unspecified. In other words, it means "num_types == 2".
---
 time/tzfile.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/time/tzfile.c b/time/tzfile.c
index 190a777152..874e10c9c7 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -429,12 +429,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
 	}
     }
   if (__tzname[0] == NULL)
-    {
-      /* This should only happen if there are no transition rules.
-	 In this case there should be only one single type.  */
-      assert (num_types == 1);
-      __tzname[0] = __tzstring (zone_names);
-    }
+    __tzname[0] = __tzstring (zone_names);
   if (__tzname[1] == NULL)
     __tzname[1] = __tzname[0];
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-12-29 23:12 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 14:50 [PATCH] time: Remove assert in reading of tz file Christopher Wong
2021-12-06 15:10 ` Florian Weimer
2021-12-06 15:16   ` Christopher Wong
2021-12-17  0:57   ` [PATCH v2] timezone: handle truncated timezones from tzcode-2021d and later (BZ #28707) Hans-Peter Nilsson
2021-12-17  2:51     ` Paul Eggert
2021-12-17 14:05       ` Carlos O'Donell
2021-12-17 20:33         ` Hans-Peter Nilsson
2021-12-17 14:24       ` Carlos O'Donell
2021-12-17 17:57         ` Paul Eggert
2021-12-17 18:11           ` Hans-Peter Nilsson
2021-12-17 18:40             ` Paul Eggert
2021-12-17 20:36       ` [PATCH v3 0/2] timezone: BZ #28707 Hans-Peter Nilsson
2021-12-17 22:22         ` Paul Eggert
2021-12-29  0:50         ` Hans-Peter Nilsson
2021-12-29 23:12           ` Adhemerval Zanella
2021-12-17 20:38       ` [PATCH v3 1/2] timezone: handle truncated timezones from tzcode-2021d and later (BZ #28707) Hans-Peter Nilsson
2021-12-17 20:45       ` [PATCH v3 2/2] timezone: test-case for BZ #28707 Hans-Peter Nilsson
2021-12-17 20:51         ` Hans-Peter Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).