Ryan Liptak
b4831403c9
fileRead functions: handle INVALID_FUNCTION on Windows and map it to error.IsDir
...
INVALID_FUNCTION may be possible in other scenarios as well, but it is verifiably returned when the handle refers to a directory.
2026-01-11 02:08:18 -08:00
InKryption
707823abdb
fix semantic UAFs in std.Io.Threaded
2026-01-10 17:43:33 +01:00
Kevin Primm
b929078dac
std.Io.Threaded: Raise specific error when DNS lookup returns no A/AAAA records
...
closes #25948
2026-01-08 20:44:47 -08:00
Jon Parise
efe649b13e
std.Io.net: make HostName.validate RFC 1123-compliant
...
The implementation of HostName.validate was too generous. It considered
strings like ".example.com", "exa..mple.com", and "-example.com" to be
valid hostnames, which is incorrect according to RFC 1123 (the currently
accepted standard).
Reviewed-on: https://github.com/ziglang/zig/pull/25710
2026-01-08 20:40:32 -08:00
Andrew Kelley
ecea8cc16d
std.Io.Threaded: refactor some error handling
2026-01-08 13:35:47 -08:00
Andrew Kelley
09028bac29
std.Io.Threaded: fix init for single-threaded
2026-01-08 12:36:41 -08:00
Andrew Kelley
b0570b807f
Merge pull request 'std.Io.Threaded: clock_nanosleep is not linux-only' ( #30746 ) from clock_nanosleep into master
...
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30746
2026-01-08 21:00:36 +01:00
Andrew Kelley
6f7968f165
Merge branch "remove many std.posix functions"
...
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30741
2026-01-08 00:19:12 -08:00
Andrew Kelley
4319c8924e
std.Io.Threaded: clock_nanosleep is not linux-only
...
clock_nanosleep is specified by POSIX but not implemented on these
hereby shamed operating systems:
* macOS
* OpenBSD (which defines TIMER_ABSTIME for some reason...?)
2026-01-07 21:13:16 -08:00
moriazoso
514b103edb
std.Io.Threaded: correctly initialize PosixAddress/WsaAddress from sockaddr ( #30722 )
...
Resolves ziglang/zig#30672 - UB caused by `std.Io.Threaded.netLookupFallible` incorrectly initializing `PosixAddress`/`WsaAddress` from `*sockaddr`.
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30722
Co-authored-by: moriazoso <greysonmurray.dev@gmail.com >
Co-committed-by: moriazoso <greysonmurray.dev@gmail.com >
2026-01-08 06:01:44 +01:00
Andrew Kelley
ce89006035
std.Io.Kqueue: fix bitrot
2026-01-07 18:00:36 -08:00
Andrew Kelley
3961fe3de9
std: move posix.kevent to Io.Kqueue
2026-01-07 17:33:07 -08:00
Andrew Kelley
2c6304efc7
std: move posix.kqueue to Io.Kqueue.createFileDescriptor
2026-01-07 17:33:07 -08:00
Andrew Kelley
7248b4a4e4
std.fs: deprecate base64 APIs
...
100% of std.fs is now deprecated.
2026-01-07 17:33:06 -08:00
Andrew Kelley
5d0929c40d
std.Io.Threaded.randomSecure: eliminate dead code
2026-01-07 11:03:37 -08:00
Andrew Kelley
1ddae8585a
std.Io.Threaded: add procfs fallback for fileHardLink
...
oof what a clunky set of functionality we have here
2026-01-07 11:03:37 -08:00
Andrew Kelley
7e8c7e5696
std.Io: fix AT_SYMLINK_FOLLOW flags
...
hard linking has the backwards default, which uses a different flag
2026-01-07 11:03:37 -08:00
Andrew Kelley
ee574f665c
std.Io.Dir: introduce renamePreserve and use it in File.Atomic.link
...
breaking change: the error for renaming over a non-empty directory now
returns error.DirNotEmpty rather than error.PathAlreadyExists.
2026-01-07 11:03:37 -08:00
Andrew Kelley
8e1850e277
std.Io.Threaded: tweak logic for use_dev_urandom
2026-01-07 11:03:37 -08:00
Andrew Kelley
0529fe3411
std.Io.Threaded: fix implementation of getRandomFd
2026-01-07 11:03:37 -08:00
Andrew Kelley
90f0d7d0da
std.Io.Threaded: implement random seed fallback for WASI
2026-01-07 11:03:37 -08:00
Andrew Kelley
7bd033275e
std.Io.Threaded: implement Windows random seed fallback
2026-01-07 11:03:37 -08:00
Andrew Kelley
1f1381a866
update API usage of std.crypto.random to io.random
2026-01-07 11:03:36 -08:00
Andrew Kelley
81a35a86ea
std.Io: introduce random and randomSecure
...
and use a thread-local CSPRNG for the former.
2026-01-07 11:03:36 -08:00
Andrew Kelley
2f639a45b4
std.Io.Threaded: implement windows random with \Device\CNG
2026-01-07 11:03:36 -08:00
Andrew Kelley
42ca9e5d8e
std.Build: remove no longer needed workaround
...
now that definitions of networking addresses are arch-independent
2026-01-07 11:03:36 -08:00
Andrew Kelley
816565dd07
std: move entropy to Io
2026-01-07 11:03:36 -08:00
Matthew Lugg
cd963ba38d
Io.Threaded: fix bad assertion
...
Resolves: https://codeberg.org/ziglang/zig/issues/30717
2026-01-07 11:27:21 +01:00
Matthew Lugg
be0a77efd2
std: re-enable some disabled tests
...
I believe these tests may have been flaky as a result of the bug fixed
in the previous commit. A big hint is that they were all crashing with
SIGSEGV with no stack trace. I suspect that some lingering SIGIOs from
cancelations were being delivered to a thread after its `munmap` call,
which was happening because the test runner called `Io.Threaded.deinit`
to cause all of the (detached) worker threads to exit.
If this passes, I'll re-run the x86_64-linux CI jobs on this commit a
few times before merge to try and be sure there are no lingering
failures.
Resolves: https://codeberg.org/ziglang/zig/issues/30096
Resolves: https://codeberg.org/ziglang/zig/issues/30592
Resolves: https://codeberg.org/ziglang/zig/issues/30682
2026-01-06 11:15:47 +00:00
Andrew Kelley
06130c5e61
std.Io.Threaded: set O_DIRECTORY along with O_TMPFILE
2026-01-05 20:31:31 -08:00
Andrew Kelley
f9a5b34e67
std.Io.Threaded: fix compilation on s390x, hexagon, or1k, m68k
...
Apparently the O_TMPFILE flag is split across two bits on these
architectures and missing on m68k.
2026-01-05 20:28:58 -08:00
Andrew Kelley
3859250c4d
std.Io.Threaded: only linux supports fileHardLink
2026-01-05 20:28:58 -08:00
Andrew Kelley
39605bd6bc
compiler: update to new createFileAtomic API
2026-01-05 20:28:58 -08:00
Andrew Kelley
4365b0df88
std.Io.Threaded: add File.hardLink
2026-01-05 20:28:58 -08:00
Andrew Kelley
81bfd28974
std.Io.Dir: rework atomic file
2026-01-05 20:28:58 -08:00
Andrew Kelley
d3d6761e43
std: depend on NtDll rather than advapi32.dll for entropy
2026-01-05 12:16:54 -08:00
Alex Rønne Petersen
ccc78252f1
std.Io.test: disable flaky recancel test on linux w/o libc
...
https://codeberg.org/ziglang/zig/issues/30592
2026-01-05 12:52:25 +01:00
Alex Rønne Petersen
bbacf42837
std.Io.test: disable flaky Group.concurrent test on linux w/o libc
...
https://codeberg.org/ziglang/zig/issues/30096
2026-01-05 12:52:18 +01:00
Michael Dusan
31a6e83a7c
openbsd: fix Io.Threaded bitrot
2026-01-05 11:28:57 +01:00
Jake Greenfield
8e091047b5
std.Io.Threaded: fix Windows env var mapping
...
Windows environment variables are case-insensitive, so the special Wtf16
comparison needs to be used, or PATH/PATHEXT might be missed.
2026-01-04 23:32:36 -05:00
Andrew Kelley
9eb3b54eb5
std.Io.Threaded: revert making reading fork child status cancelable
...
this caused the build runner to crash sometimes, not sure why yet
2026-01-04 00:27:09 -08:00
Andrew Kelley
854c076ff7
std.Io.Threaded: improve posix spawning
...
* avoid unreachable when the OS does something unexpected
* make waiting for the fork/exec error report cancelable
2026-01-04 00:27:09 -08:00
Andrew Kelley
fa315b1060
std.Io.Threaded: improve posix process creation
...
* cache /dev/null after opening
* make opening /dev/null cancelable
* avoid unreachable even when OS does something unexpected
2026-01-04 00:27:09 -08:00
Andrew Kelley
2c22c3dabf
std.Io.Threaded: make processReplace cancelable
...
In between each attempt to call execve() on a particular file path, it
will check cancelation before trying the next PATH.
2026-01-04 00:27:09 -08:00
Andrew Kelley
08d8b412e9
std.Io.Threaded: more robust windows process creation error handling
2026-01-04 00:27:09 -08:00
Andrew Kelley
f072313e1e
std.Io.Threaded: delete dead comment
...
The problem it talked about is solved now that the direct call to
dirOpenDirWindows makes sense in this context.
2026-01-04 00:27:09 -08:00
Andrew Kelley
2b326d27d5
std.Io.Threaded: improve various Windows logic
...
* cache nul handle for child process execution
* make opening the nul file integrate properly with cancelation
* replace all calls to SleepEx to parking_sleep.sleep instead, making
them properly cancelable. These sleeps are workarounds for Windows
kernel bugs. Now you can even cancel while waiting for kernel bug
workarounds!
2026-01-04 00:27:09 -08:00
Andrew Kelley
be977e1934
std.Io.Threaded: integrate with new cancel mechanism
2026-01-04 00:27:09 -08:00
Andrew Kelley
dd7be75f7c
std.process: add missing error.OperationUnsupported
2026-01-04 00:27:09 -08:00
Andrew Kelley
baa49e5929
std.Io.Threaded: implement processReplace
2026-01-04 00:27:09 -08:00