public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/109857] New: tzdata 2021a has bad data that cannot be parsed by libstdc++
@ 2023-05-14 20:57 redi at gcc dot gnu.org
  2023-05-14 20:59 ` [Bug libstdc++/109857] " redi at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-05-14 20:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109857

            Bug ID: 109857
           Summary: tzdata 2021a has bad data that cannot be parsed by
                    libstdc++
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

On debian stable the tzdata.zi file is from version 2021a of the IANA time zone
database and contains this line:

R K 2023 Max - O lastTh 24 0 -

This is invalid, because the fourth field should be "max" not "Max". This
causes libstdc++ to fail to parse the tzdata file and use a UTC-only fallback.

Maybe we should do:

--- a/libstdc++-v3/src/c++20/tzdb.cc
+++ b/libstdc++-v3/src/c++20/tzdb.cc
@@ -345,8 +345,9 @@ namespace std::chrono

       friend istream& operator>>(istream& in, minmax_year&& y)
       {
-       if (ws(in).peek() == 'm') // keywords "minimum" or "maximum"
+       if (unsigned char c = ws(in).peek(); std::tolower(c) == 'm')
          {
+           // keywords "minimum" or "maximum"
            string s;
            in >> s; // extract the rest of the word, but only look at s[1]
            if (s[1] == 'a')


We should also consider ignoring the system tzdata files if the bundled copy
(currently 2023c) is newer. Or at least try using the bundled one if the
parsing the system file fails, as in this case.

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

end of thread, other threads:[~2024-05-21  9:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-14 20:57 [Bug libstdc++/109857] New: tzdata 2021a has bad data that cannot be parsed by libstdc++ redi at gcc dot gnu.org
2023-05-14 20:59 ` [Bug libstdc++/109857] " redi at gcc dot gnu.org
2023-05-15 13:45 ` redi at gcc dot gnu.org
2023-05-15 14:19 ` [Bug libstdc++/109857] Debian stable's " redi at gcc dot gnu.org
2023-05-16 11:55 ` redi at gcc dot gnu.org
2023-05-16 11:59 ` redi at gcc dot gnu.org
2023-07-27  9:26 ` rguenth at gcc dot gnu.org
2024-05-21  9:15 ` jakub at gcc dot gnu.org

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).