std::chrono::locate_zone("Asia/Chungking") fails

Bug #2062522 reported by Matthias Klose
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
glibc (Ubuntu)
Invalid
Undecided
Unassigned
tzdata (Ubuntu)
Fix Released
Medium
Unassigned
Noble
Fix Released
Undecided
Unassigned

Bug Description

[ Impact ]

forwarded from
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114770

```
#include <chrono>
int main()
{
  (void) std::chrono::locate_zone("Asia/Chungking");
}
```

With the latest tzdata (version 2024a-2) on Debian Sid this fails:

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

The problem is a Debian patch that enables link chaining, so that one link can have another link as its target:
https://sources.debian.org/patches/tzdata/2024a-2/ziguard.awk-Move-link-to-link-feature-from-vanguard-to-ma.patch/

This feature was added to tzdata in 2022, but isn't compatible with the expectations of the C++20 standard. When chrono::locate_zone finds a link, it expects its target to be a zone, not another link.

[ Test Plan ]

1. Install tzdata-legacy
2. Create `testcase.cpp`:

```
#include <chrono>
int main()
{
  (void) std::chrono::locate_zone("Asia/Chungking");
}
```

3. Compile: `g++ -std=c++20 -o testcase testcase.cpp`
4. Run: `./testcase`

The test case should not crash.

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

This bug report is misleading, because Asia/Chungking is not a symlink to another symlink:

```
$ ls -l /usr/share/zoneinfo/Asia/Chungking /usr/share/zoneinfo/Asia/Shanghai
lrwxrwxrwx 1 root root 8 Apr 5 20:24 /usr/share/zoneinfo/Asia/Chungking -> Shanghai
-rw-r--r-- 1 root root 561 Apr 5 20:24 /usr/share/zoneinfo/Asia/Shanghai
```

Asia/Chungking is part of tzdata-legacy and this package is probably not installed.

Anyways, I'll replace the symlinks that point to symlinks.

description: updated
Benjamin Drung (bdrung)
Changed in tzdata (Ubuntu):
status: New → Fix Committed
importance: Undecided → Medium
Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello Matthias, or anyone else affected,

Accepted tzdata into noble-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/tzdata/2024a-3ubuntu1 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.

Changed in tzdata (Ubuntu Noble):
status: New → Fix Committed
tags: added: verification-needed verification-needed-noble
Revision history for this message
Benjamin Drung (bdrung) wrote :

This is a follow-up fix for the fix in bug #2055718

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

Verified that tzdata-legacy 2024a-2ubuntu1 crashes with the test case.

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

Waiting for the package to hit the mirror...

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (tzdata/2024a-3ubuntu1)

All autopkgtests for the newly accepted tzdata (2024a-3ubuntu1) for noble have finished running.
The following regressions have been reported in tests triggered by the package:

chrony/unknown (ppc64el)
golang-github-lib-pq/1.10.9-2 (amd64, arm64)
pandas/2.1.4+dfsg-7 (arm64)
prometheus-alertmanager/0.26.0+ds-1 (armhf)
python-tempora/unknown (ppc64el)
reposurgeon/4.38-1 (ppc64el)
ruby-tzinfo/unknown (ppc64el)
tzdata/2024a-3ubuntu1 (armhf)
tzdata/unknown (ppc64el)
ubuntu-dev-tools/0.201ubuntu2 (amd64, arm64, armhf, i386, ppc64el, 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/noble/update_excuses.html#tzdata

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

Thank you!

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

Verification failed. The C++ code seems to read /usr/share/zoneinfo/tzdata.zi which still has the wrong link:

```
$ dpkg -s tzdata | grep ^Version
Version: 2024a-3ubuntu1
$ grep Asia/Chungking /usr/share/zoneinfo/tzdata.zi
L Asia/Chongqing Asia/Chungking
$ ls -l /usr/share/zoneinfo/Asia/Chungking
lrwxrwxrwx 1 root root 8 Apr 19 19:51 /usr/share/zoneinfo/Asia/Chungking -> Shanghai
```

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

Uploaded tzdata 2024a-3ubuntu1.1 to apply the follow-up fix.

Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Matthias, or anyone else affected,

Accepted tzdata into noble-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/tzdata/2024a-3ubuntu1.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
Benjamin Drung (bdrung) wrote :

Verified that the testcase does not crash any more after updating tzdata:

```
$ ./testcase
$ dpkg -s tzdata | grep ^Version
Version: 2024a-3ubuntu1.1
```

tags: added: verification-done verification-done-noble
removed: verification-needed verification-needed-noble
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (tzdata/2024a-3ubuntu1.1)

All autopkgtests for the newly accepted tzdata (2024a-3ubuntu1.1) for noble have finished running.
The following regressions have been reported in tests triggered by the package:

astropy/unknown (armhf)
chrony/unknown (s390x)
dateparser/unknown (armhf)
golang-github-araddon-dateparse/unknown (armhf)
golang-github-rickb777-date/unknown (armhf)
golang-github-teambition-rrule-go/unknown (armhf)
libdatetime-timezone-perl/unknown (armhf)
orthanc/unknown (s390x)
pandas/unknown (armhf)
php8.3/unknown (s390x)
postgresql-16/unknown (armhf)
prometheus-alertmanager/unknown (armhf)
reposurgeon/unknown (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/noble/update_excuses.html#tzdata

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

Thank you!

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

All autopkgtest runs succeeded except four autopkgtest fail on armhf with tmpfail:

* dateparser
* golang-github-rickb777-date
* prometheus-alertmanager
* reposurgeon

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

This bug was fixed in the package tzdata - 2024a-4ubuntu1

---------------
tzdata (2024a-4ubuntu1) oracular; urgency=medium

  * Merge with Debian unstable. Remaining changes:
    - Ship 2024a ICU timezone data which are utilized by PHP in tzdata-icu
    - Add autopkgtest test case for ICU timezone data
    - Do not rename NEWS into changelog.gz, this fixes a build failure on
      moment-timezone.js
    - Point Vcs-Browser/Git to Launchpad
    - generate_debconf_templates: Work around AttributeError on icu import

tzdata (2024a-4) unstable; urgency=medium

  * d/rules: Support creating symlinks pointing to symlinks
  * Fixup for avoid timezones being symlinks to symlinks (LP: #2062522)

tzdata (2024a-3) unstable; urgency=medium

  * Avoid timezones being symlinks to symlinks to avoid breaking C++20 standard
    expectation (LP: #2062522)

 -- Benjamin Drung <email address hidden> Thu, 02 May 2024 18:34:12 +0200

Changed in tzdata (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Simon Chopin (schopin) wrote :

It seems this doesn't have anything to do with glibc? Marking as Invalid there.

Changed in glibc (Ubuntu):
status: New → Invalid
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package tzdata - 2024a-3ubuntu1.1

---------------
tzdata (2024a-3ubuntu1.1) noble; urgency=medium

  * d/rules: Support creating symlinks pointing to symlinks
  * Fixup for avoid timezones being symlinks to symlinks (LP: #2062522)

tzdata (2024a-3ubuntu1) noble; urgency=medium

  * Merge with Debian unstable. Remaining changes:
    - Ship 2024a ICU timezone data which are utilized by PHP in tzdata-icu
    - Add autopkgtest test case for ICU timezone data
    - Do not rename NEWS into changelog.gz, this fixes a build failure on
      moment-timezone.js
    - Point Vcs-Browser/Git to Launchpad
    - generate_debconf_templates: Work around AttributeError on icu import

tzdata (2024a-3) unstable; urgency=medium

  * Avoid timezones being symlinks to symlinks to avoid breaking C++20 standard
    expectation (LP: #2062522)

 -- Benjamin Drung <email address hidden> Fri, 03 May 2024 13:27:11 +0200

Changed in tzdata (Ubuntu Noble):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) 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.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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