Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc++][chrono] interaction with system tzdb on macos? #117451

Open
h-vetinari opened this issue Nov 23, 2024 · 0 comments
Open

[libc++][chrono] interaction with system tzdb on macos? #117451

h-vetinari opened this issue Nov 23, 2024 · 0 comments
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@h-vetinari
Copy link
Contributor

h-vetinari commented Nov 23, 2024

The tzdb in libc++ are currently disabled on osx

_LIBCPP_WEAK string_view __libcpp_tzdb_directory() {
#if defined(__linux__)
return "/usr/share/zoneinfo/";
#else
# error "unknown path to the IANA Time Zone Database"
#endif
}

However, the code itself (unsurprisingly) works fine also on osx, and we've enabled (and tested) it in our distribution (minus the leap-second bits, which need leap-seconds.list that's not shipped by default).

Presumably, the problem is where to find the tzdb, especially with any degree of consistency across different OS versions. I would have assumed that -- over time -- Apple would start shipping the necessary leap-seconds.list in whatever ends up being symlinked behind /usr/share/zoneinfo.

However, rather than this file getting added, it seems now that even the tzdata.zi that libc++ is using

filesystem::path __root = chrono::__libcpp_tzdb_directory();
ifstream __tzdata{__root / "tzdata.zi"};

is getting removed? I noticed this when our tests started failing, and opened an issue on the repo where those images are mainained, where the information I got was

It seems that Apple has stopped providing the time zone data file because, for macOS, the primary representation of time zone data is now in binary format, rather than this auxiliary text file.

Is that true @ldionne? I mean yes, people can download tzdata themselves, extract it somewhere and point to that, but given that it's already on the system, it seems to me that the system should provide what libc++ uses -- or vice versa -- that libc++ uses what the system provides.

Long-term, in our distribution, we'll end up pointing libc++ to our own tzdata as soon as the chrono bits move out of the static libc++experimental.a (which we cannot patch without creating security holes) and into the dylib. But because many users are already wanting to use the tzdb-enabled <chrono>, and libc++ is the last C++ stdlib that doesn't have full support, I'm also interested in making sure these bits work before that happens.

@github-actions github-actions bot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

No branches or pull requests

1 participant