std::chrono::locate_zone("Asia/Chungking") fails
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:/
```
#include <chrono>
int main()
{
(void) std::chrono:
}
```
With the latest tzdata (version 2024a-2) on Debian Sid this fails:
terminate called after throwing an instance of 'std::runtime_
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:/
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:
}
```
3. Compile: `g++ -std=c++20 -o testcase testcase.cpp`
4. Run: `./testcase`
The test case should not crash.
Changed in tzdata (Ubuntu): | |
status: | New → Fix Committed |
importance: | Undecided → Medium |
This bug report is misleading, because Asia/Chungking is not a symlink to another symlink:
``` zoneinfo/ Asia/Chungking /usr/share/ zoneinfo/ Asia/Shanghai zoneinfo/ Asia/Chungking -> Shanghai zoneinfo/ Asia/Shanghai
$ ls -l /usr/share/
lrwxrwxrwx 1 root root 8 Apr 5 20:24 /usr/share/
-rw-r--r-- 1 root root 561 Apr 5 20:24 /usr/share/
```
Asia/Chungking is part of tzdata-legacy and this package is probably not installed.
Anyways, I'll replace the symlinks that point to symlinks.