-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Fix TLS, io.async() and package fetching on Windows
#25817
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
base: master
Are you sure you want to change the base?
Conversation
8be537e to
559eaa3
Compare
|
@squeek502 Sorry, I saw your PR #25814 with the same |
|
No worries, I've closed #25814 in favor of this. On the off chance it's helpful context, I'll put the OP of that here as well:
|
|
If we want to be more specific, we may want to reference some relevant standard or specifically declare that the clock is the number of "non-leap seconds" since the unix epoch. |
This fixes `std.http.Client` TLS certificate validation on Windows.
…Unix epoch `Clock.real` being defined to return timestamps relative to an implementation-specific epoch means that there's currently no way for the user to translate returned timestamps to actual calendar dates without digging into implementation details of any particular `Io` implementation. Redefining it to return timestamps relative to 1970-01-01T00:00:00Z fixes this problem. There are other ways to solve this, such as adding a new vtable function for returning the implementation-specific epoch, but in terms of complexity this redefinition is by far the simplest solution and only amounts to a simple 96-bit integer addition's worth of overhead on OSes like Windows that use non-POSIX/Unix epochs.
This fixes package fetching on Windows. Previously, `Async/GroupClosure` allocations were only aligned for the closure struct type, which resulted in panics when `context_alignment` (or `result_alignment` for that matter) had a greater alignment.
559eaa3 to
02ef257
Compare
Closes #25776
This fixes the HTTPS/TLS and package manager problems on Windows. Tested against the repro in the linked issue as well as by
zig build --fetching https://github.com/castholm/zig-examples/tree/master/breakout with an empty global package cache. (Déjà vu, anyone?)Cheekiness aside, there were two separate issues unrelated to each other that regressed the package manager on Windows: TLS certificate lifetimes not being validated correctly and
io.async()closure contexts not being correctly aligned, which have now hopefully been fixed.Semi-important change: This PR redefines
Clock.realsuch that implementations should always return timestamps relative to the POSIX/Unix epoch 1970-01-01 00:00:00+00:00. Previously, implementations were allowed to use implementation-specific epochs, which means that there's no way for the user to translate returned timestamps to actual calendar dates without digging into implementation details of any particularIoimplementation and is obviously a problem ifIois supposed to be the "bring-your-own-OS" interface. Redefining it in this manner fixes this.There are other ways to solve this, such as adding new vtable functions for returning the implementation-specific epoch, but in terms of complexity this redefinition is by far the simplest solution and only amounts to a simple 96-bit integer addition's worth of overhead for OSes like Windows that use non-POSIX/Unix epochs.