tzdata-2024b-0ubuntu0.24.04 makes std::chrono unusable

Bug #2096974 reported by Daniel Nöh
26
This bug affects 3 people
Affects Status Importance Assigned to Milestone
gcc-14 (Ubuntu)
Confirmed
Undecided
Unassigned
Focal
Confirmed
Undecided
Unassigned
Jammy
Confirmed
Undecided
Unassigned
Noble
Confirmed
Undecided
Unassigned
Oracular
Confirmed
Undecided
Unassigned
tzdata (Ubuntu)
Fix Released
High
Unassigned
Focal
Fix Released
Undecided
Unassigned
Jammy
Fix Released
Undecided
Unassigned
Noble
Fix Released
Critical
Unassigned
Oracular
Fix Released
Undecided
Unassigned
waybar (Ubuntu)
Confirmed
Undecided
Unassigned
Focal
Confirmed
Undecided
Unassigned
Jammy
Confirmed
Undecided
Unassigned
Noble
Confirmed
Undecided
Unassigned
Oracular
Confirmed
Undecided
Unassigned

Bug Description

[ Impact ]
The latest tzdata SRU[1] included a change[2] in the main data form:

    The main source files' time zone abbreviations now use %z,
    supported by zic since release 2015f and used in vanguard form
    since release 2022b. For example, America/Sao_Paulo now contains
    the zone continuation line "-3:00 Brazil %z", which is less error
    prone than the old "-3:00 Brazil -03/-02". This does not change
    the represented data: the generated TZif files are unchanged.
    Rearguard form still avoids %z, to support obsolescent parsers.

Turns out the standard c++ library in at least oracular and noble fail to parse that, resulting in a much small list of available timezones, or even crashes[3].

The c++ fix for that is in [4]. That might be eventually SRUed, but at the moment it's quicker to adjust tzdata than the c++ library. Also, there might be other parsers in the supported Ubuntu releases that are also affected, and just haven't been noticed yet.

1. https://launchpad.net/bugs/2070285
2. https://github.com/eggert/tz/commit/94e6b3b0eb773e66a9ac49b905c69c0fa6a31dc3
3. https://bugs.launchpad.net/ubuntu/+source/tzdata/+bug/2096974/comments/10
4. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116657

[ Test Plan ]

This update includes a new DEP8 test that checks specifically for this bug. Therefore, the test plan is to observe that the full suite of autopkgtests is run and that it passed.

For jammy and focal, which do not contain the c++ library function that is failing, build this small C++ app in *NOBLE*:

#include <chrono>
#include <iostream>

int main() {
    for (const auto & time_zone : std::chrono::get_tzdb().zones) {
        std::cout << time_zone.name() << std::endl;
    }
}

Build and link statically, like so (assuming the file is called test.cpp):

  g++ -std=c++20 -o test test.cpp -static

Then copy the resulting binary ("test") to the jammy and focal systems under test.

An affected system will show just two timezones:

  $ ~/test
  Etc/GMT
  Etc/UTC

Whereas a fixed system will show hundreds.

[ Where problems could occur ]

All software that use tzdata could be affected by this update. There is probably at least one implementation in each programming language for reading the timezone data. The update could trigger parser bugs.

The autopkgtest will cover Python's zoneinfo and now C++ std::chrono.

[ Original Description ]

inalling tzdata in version 2024b-0ubuntu0.24.04 causes std::chrono to deliver only 2 timezones:

code:

for (const auto & time_zone : std::chrono::get_tzdb().zones)
{
  std::cout << time_zone.name() << std::endl;
}

output:

Etc/GMT
Etc/UTC

Related branches

Revision history for this message
Daniel Nöh (wodn) wrote :

corresponding fix exists: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116657
but the mentioned versions are not yet available on ubuntu

Benjamin Drung (bdrung)
tags: added: regression-update
Revision history for this message
Benjamin Drung (bdrung) wrote :

I can reproduce that behavior and distilled a test case for tzdata.

Changed in tzdata (Ubuntu):
importance: Undecided → High
status: New → Triaged
Revision history for this message
Benjamin Drung (bdrung) wrote :

Test results:

* plucky 2024b-6ubuntu1 is NOT affected
* oracular 2024b-1ubuntu2.1 is affected
* noble 2024b-0ubuntu0.24.04 is affected
* jammy fails to compile the example code:

error: ‘get_tzdb’ is not a member of ‘std::chrono’
    6 | for (const auto & time_zone : std::chrono::get_tzdb().zones) {
      | ^~~~~~~~

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gcc-14 (Ubuntu):
status: New → Confirmed
no longer affects: zoneinfo
Changed in tzdata (Ubuntu Noble):
milestone: none → ubuntu-24.04.2
importance: Undecided → High
Revision history for this message
Benjamin Drung (bdrung) wrote :

It looks like the upstream commit https://github.com/eggert/tz/commit/94e6b3b0eb773e66a9ac49b905c69c0fa6a31dc3 is the reason for it.

As workaround switch from the main format to the rearguard format until std::chrono is fixed. The NEWS file says:

    The main source files' time zone abbreviations now use %z,
    supported by zic since release 2015f and used in vanguard form
    since release 2022b. For example, America/Sao_Paulo now contains
    the zone continuation line "-3:00 Brazil %z", which is less error
    prone than the old "-3:00 Brazil -03/-02". This does not change
    the represented data: the generated TZif files are unchanged.
    Rearguard form still avoids %z, to support obsolescent parsers.

Revision history for this message
Benjamin Drung (bdrung) wrote (last edit ):
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Please test proposed package

Hello Daniel, or anyone else affected,

Accepted tzdata into oracular-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/tzdata/2024b-1ubuntu2.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-oracular to verification-done-oracular. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-oracular. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in tzdata (Ubuntu Oracular):
status: New → Fix Committed
tags: added: verification-needed verification-needed-oracular
Changed in tzdata (Ubuntu Noble):
status: New → Fix Committed
tags: added: verification-needed-noble
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Hello Daniel, or anyone else affected,

Accepted tzdata into noble-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/tzdata/2024b-0ubuntu0.24.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-noble to verification-done-noble. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-noble. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Taylor Brown (tbrown122387) wrote :

Works for me! After

wget http://archive.ubuntu.com/ubuntu/pool/main/t/tzdata/tzdata_2024b-1ubuntu2.2_all.deb
sudo dpkg -i tzdata_2024b-1ubuntu2.2_all.deb

c++ lines with

std::chrono::locate_zone("America/New_York")

no longer throw an error such as

terminate called after throwing an instance of 'std::runtime_error'
  what(): std::chrono::tzdb: cannot locate zone: America/New_York
Aborted (core dumped)

Revision history for this message
Daniel Nöh (wodn) wrote :

HI,

yes, the proposed version 2024b-0ubuntu0.24.04.1 works fine!

Revision history for this message
Anders Lindstrom (anderu) wrote :

Works for me too. Thanks.

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (tzdata/2024b-1ubuntu2.2)

All autopkgtests for the newly accepted tzdata (2024b-1ubuntu2.2) for oracular have finished running.
The following regressions have been reported in tests triggered by the package:

python3.12/3.12.7-1ubuntu1.1 (ppc64el)
python3.13/3.13.0-1 (arm64)
python3.13/unknown (s390x)
tzdata/2024b-1ubuntu2.2 (amd64, s390x)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/oracular/update_excuses.html#tzdata

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (tzdata/2024b-0ubuntu0.24.04.1)

All autopkgtests for the newly accepted tzdata (2024b-0ubuntu0.24.04.1) for noble have finished running.
The following regressions have been reported in tests triggered by the package:

astropy/6.0.0-1ubuntu2 (arm64, armhf, ppc64el, s390x)
tzdata/2024b-0ubuntu0.24.04.1 (amd64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/noble/update_excuses.html#tzdata

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Thank you all! We pushed this to proposed even before having a complete test plan and SRU template, apologies for that. But there is a new autopkgtest to test exactly this behavior (thanks bdrung!). I'm trying to sort out the test failures now, I've seen already that a few were due to infrastructure failures and retried them.

description: updated
description: updated
description: updated
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

This is fixing a regression in the previous SRU (which is currently in updates)

Changed in tzdata (Ubuntu Noble):
importance: High → Critical
Revision history for this message
David Ainsworth (aindj) wrote :

It's worth saying that jammy is also affected by this bug
Even though you can't compile the reproducer c++ code with the packaged version of gcc, it's still possible to either install gcc13 and compile/run it or to run a binary compiled on a different machine and trigger the issue

Benjamin Drung (bdrung)
description: updated
Revision history for this message
Benjamin Drung (bdrung) wrote :

The test TestTimeUT1SpecificIERSTable.test_ut1_iers_A from astropy/6.0.0-1ubuntu2 on noble seem to regress with both 2024b SRU uploads.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

It did pass[1] with 2024a back in 2024-05-03, so maybe it's sensitive to the date.

1. https://autopkgtest.ubuntu.com/results/autopkgtest-noble/noble/ppc64el/a/astropy/20240503_141545_cef6c@/log.gz

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

> Even though you can't compile the reproducer c++ code with the packaged version of gcc, it's still
> possible to either install gcc13 and compile/run it or to run a binary compiled on a different machine
> and trigger the issue

Indeed, and jammy/focal have tasks in this bug to be fixed as well. We are more immediately worried about noble because of the imminent 24.04.2 point release next week.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Retrying the python3.12/tzdata test in oracular/ppc64el... https://autopkgtest.ubuntu.com/packages/python3.12/oracular/ppc64el

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

The autopkgtests are all green now, for oracular and noble. Per test plan, that is the verification, and we also had confirmation in multiple comments that this update fixed the issue.

tags: added: verification-done-noble verification-done-oracular
removed: verification-needed-noble verification-needed-oracular
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package tzdata - 2024b-1ubuntu2.2

---------------
tzdata (2024b-1ubuntu2.2) oracular; urgency=medium

  * Revert using %z in tzdata.zi data form (LP: #2096974):
    - Enable link to link feature also for rearguard dataform
    - Use dataform rearguard for C++ std::chrono
    - Add chrono autopkgtest to test C++ std::chrono::tzdb parser

 -- Benjamin Drung <email address hidden> Thu, 30 Jan 2025 20:42:02 +0100

Changed in tzdata (Ubuntu Oracular):
status: Fix Committed → Fix Released
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Update Released

The verification of the Stable Release Update for tzdata has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package tzdata - 2024b-0ubuntu0.24.04.1

---------------
tzdata (2024b-0ubuntu0.24.04.1) noble; urgency=medium

  * Revert using %z in tzdata.zi data form (LP: #2096974):
    - Enable link to link feature also for rearguard dataform
    - Use dataform rearguard for C++ std::chrono
    - Add chrono autopkgtest to test C++ std::chrono::tzdb parser

 -- Benjamin Drung <email address hidden> Thu, 30 Jan 2025 22:33:14 +0100

Changed in tzdata (Ubuntu Noble):
status: Fix Committed → Fix Released
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Please test proposed package

Hello Daniel, or anyone else affected,

Accepted tzdata into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/tzdata/2024b-0ubuntu0.22.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

description: updated
Changed in tzdata (Ubuntu Jammy):
status: New → Fix Committed
tags: added: verification-needed-jammy
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Hello Daniel, or anyone else affected,

Accepted tzdata into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/tzdata/2024b-0ubuntu0.20.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in tzdata (Ubuntu Focal):
status: New → Fix Committed
tags: added: verification-needed-focal
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (tzdata/2024b-0ubuntu0.20.04.1)

All autopkgtests for the newly accepted tzdata (2024b-0ubuntu0.20.04.1) for focal have finished running.
The following regressions have been reported in tests triggered by the package:

icu/66.1-2ubuntu2.1 (s390x)
postgresql-12/12.22-0ubuntu0.20.04.1 (amd64, s390x)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/focal/update_excuses.html#tzdata

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (tzdata/2024b-0ubuntu0.22.04.1)

All autopkgtests for the newly accepted tzdata (2024b-0ubuntu0.22.04.1) for jammy have finished running.
The following regressions have been reported in tests triggered by the package:

chrony/4.2-2ubuntu2 (armhf, ppc64el)
php8.1/8.1.2-1ubuntu2.20 (armhf)
postgresql-14/14.15-0ubuntu0.22.04.1 (armhf)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/jammy/update_excuses.html#tzdata

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Daniel Nöh (wodn) wrote :

hi,
yes, version 2024b-0ubuntu0.20.04.1 look fine!

Revision history for this message
Benjamin Drung (bdrung) wrote :

The autopkgtest for 2024b-0ubuntu0.22.04.1 and 2024b-0ubuntu0.20.04.1 are successful after retrying some failed ones.

Revision history for this message
Benjamin Drung (bdrung) wrote :

I built the static test executable on noble and verified jammy:

```
$ schroot-wrapper -c jammy-debug -p tzdata -e
(jammy-debug)bdrung@host:~$ ./test | wc -l
446
(jammy-debug)bdrung@host:~$ dpkg -s tzdata | grep ^Version
Version: 2024b-0ubuntu0.22.04.1
```

Before:

```
$ schroot-wrapper -c jammy-debug -p tzdata
(jammy-debug)bdrung@host:~$ ./test
Etc/GMT
Etc/UTC
(jammy-debug)bdrung@host:~$ dpkg -s tzdata | grep ^Version
Version: 2024b-0ubuntu0.22.04
```

Verified focal:

```
$ schroot-wrapper -c focal-debug -p tzdata -e
(focal-debug)bdrung@host:~$ ./test | wc -l
446
(focal-debug)bdrung@host:~$ dpkg -s tzdata | grep ^Version
Version: 2024b-0ubuntu0.20.04.1
```

tags: added: verification-done verification-done-focal verification-done-jammy
removed: verification-needed verification-needed-focal verification-needed-jammy
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package tzdata - 2024b-0ubuntu0.22.04.1

---------------
tzdata (2024b-0ubuntu0.22.04.1) jammy; urgency=medium

  * Revert using %z in tzdata.zi data form (LP: #2096974):
    - Enable link to link feature also for rearguard dataform
    - Use dataform rearguard for C++ std::chrono

 -- Benjamin Drung <email address hidden> Fri, 31 Jan 2025 13:53:56 +0100

Changed in tzdata (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package tzdata - 2024b-0ubuntu0.20.04.1

---------------
tzdata (2024b-0ubuntu0.20.04.1) focal; urgency=medium

  * Revert using %z in tzdata.zi data form (LP: #2096974):
    - Enable link to link feature also for rearguard dataform
    - Use dataform rearguard for C++ std::chrono

 -- Benjamin Drung <email address hidden> Sat, 01 Feb 2025 13:04:09 +0100

Changed in tzdata (Ubuntu Focal):
status: Fix Committed → Fix Released
Benjamin Drung (bdrung)
Changed in tzdata (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gcc-14 (Ubuntu Focal):
status: New → Confirmed
Changed in gcc-14 (Ubuntu Jammy):
status: New → Confirmed
Changed in gcc-14 (Ubuntu Noble):
status: New → Confirmed
Changed in gcc-14 (Ubuntu Oracular):
status: New → Confirmed
Changed in waybar (Ubuntu Focal):
status: New → Confirmed
Changed in waybar (Ubuntu Jammy):
status: New → Confirmed
Changed in waybar (Ubuntu Noble):
status: New → Confirmed
Changed in waybar (Ubuntu Oracular):
status: New → Confirmed
Changed in waybar (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.