Andrew Kelley
debf307594
update all incremental tests to new std API
...
they're still not passing on windows for some reason though
2025-12-23 22:15:11 -08:00
Andrew Kelley
77d2ad8c92
std: consolidate all instances of std.Io.Threaded into a singleton
...
It's better to avoid references to this global variable, but, in the
cases where it's needed, such as in std.debug.print and collecting stack
traces, better to share the same instance.
2025-12-23 22:15:11 -08:00
Andrew Kelley
50c585227e
fix compilation of incr-check
2025-12-23 22:15:11 -08:00
Andrew Kelley
7d955274bb
update the init templates to new std API
2025-12-23 22:15:11 -08:00
Andrew Kelley
2e4a6c88b5
compiler: fix test-unit compilation failures
2025-12-23 22:15:11 -08:00
Andrew Kelley
99f25bfc23
std.Io: implement directory reading for WASI
2025-12-23 22:15:11 -08:00
Andrew Kelley
98f05a0f53
compiler: update calls to realpath
2025-12-23 22:15:11 -08:00
Andrew Kelley
7423d6a404
fix "hello world"
...
14K -> 57K
2025-12-23 22:15:11 -08:00
Andrew Kelley
e41342af83
std.Io.Threaded: reinstate fchmodat fallback
...
Stephen Gregoratto (original author of the fallback) says:
I read through both libcs again to compare:
Musl:
- `stat` path. Check error.
- If path is a symlink, return `OPNOTSUPP`.
- `openat` path as `O_PATH|O_NOFOLLOW|O_CLOEXEC`. Return `OPNOTSUPP` if we got `ELOOP`.
- Build procfs filename.
- `stat` procfs file.
- If procfs file is a symlink, return `OPNOTSUPP`.
- close path fd.
Glibc:
- open path as `O_PATH|O_NOFOLLOW|O_CLOEXEC`.
- fstatat path fd.
- If path is a symlink, return `OPNOTSUPP`.
- Build procfs filename.
- chmod procfs filename. Return `OPNOTSUPP` if we got `ENOENT`.
- close path fd.
I prefer glibc since you open the path first, which avoids a possible
TOCTOU race.
2025-12-23 22:15:11 -08:00
Andrew Kelley
64de4a7371
std.Io.Threaded: remove handling of ECANCELED
...
The only known situation in which this occurs is when using musl with
the undocumented extension PTHREAD_CANCEL_MASKED, causing the next
syscall to return ECANCELED.
However zig std lib does not use this mechanism, even when targeting
musl libc because it would require each async task to be on a fresh
pthread.
For the same reason, if third party code were to cause ECANCELED to be
returned from any of these syscalls, it would cause subsequent tasks to
be incorrectly canceled since they cannot be rearmed.
Thus, this Io implementation cannot handle this error code correctly,
expecting never to receive it.
2025-12-23 22:15:11 -08:00
Andrew Kelley
a8088306f6
std: rename other Dir "make" functions to "create"
2025-12-23 22:15:11 -08:00
Andrew Kelley
6e0c7ed865
std: rename makeDir to createDir for consistency with createFile
2025-12-23 22:15:11 -08:00
Andrew Kelley
52ba2a4c72
std.Io.Threaded: don't assume dirents are aligned
...
Linux kernel seems to do it but qemu user mode seems not to.
2025-12-23 22:15:11 -08:00
Andrew Kelley
6cfd2df695
don't skip test for closed issue
2025-12-23 22:15:11 -08:00
Andrew Kelley
bf81666beb
std.fs.test: don't try to test nonexistent API
2025-12-23 22:15:11 -08:00
Andrew Kelley
88110139fe
std.Io.Threaded: fix NetBSD compilation
2025-12-23 22:15:11 -08:00
Andrew Kelley
4025af9c05
std.Io.Threaded: fix fchmodat on linux with libc
2025-12-23 22:15:11 -08:00
Andrew Kelley
6aa31cedb7
std.Io.Dir.Reader: fix min_buffer_len on 32-bit linux
...
dirents64 still uses 8 byte alignment on 32-bit systems
2025-12-23 22:15:11 -08:00
Andrew Kelley
3e624e17a4
std: fix compilation errors on FreeBSD
2025-12-23 22:15:11 -08:00
Andrew Kelley
405db921dc
std: fix compilation targeting WASI
2025-12-23 22:15:11 -08:00
Andrew Kelley
1381f9f612
std.debug: fix printLineFromFile
...
by using streamDelimiter and discardDelimiter functions that don't
depend on the buffer size being large enough
2025-12-23 22:15:11 -08:00
Andrew Kelley
ac11b82738
std.Io.Threaded: fix splat buffer calculations
2025-12-23 22:15:11 -08:00
Andrew Kelley
d060cb8cd6
std: fix test "max file name component lengths"
2025-12-23 22:15:11 -08:00
Andrew Kelley
002d444964
std: fix Io.Dir.min_buffer_len on Linux
2025-12-23 22:15:11 -08:00
Andrew Kelley
018e34271f
std.fs.test: fix rebase conflicts
2025-12-23 22:15:11 -08:00
Ryan Liptak
3431f45031
std: Enough fixes to get things compiling on Windows
2025-12-23 22:15:11 -08:00
Ryan Liptak
1136d36362
windows: Remove BadPathName from error set of GetFinalPathNameByHandle
...
These validations are really only checking for kernel/mount manager
bugs, so an assert seems more appropriate.
2025-12-23 22:15:11 -08:00
Andrew Kelley
07c4ea2de0
all comments are notes, and use doc comments where possible
2025-12-23 22:15:11 -08:00
Ryan Liptak
edcbd7ed2c
os.windows: Add comment explaining why we don't need a separate EX definition for RENAME_INFORMATION
2025-12-23 22:15:10 -08:00
Ryan Liptak
b6cde02322
fs tests: Remove references to readLinkW which no longer exists
2025-12-23 22:15:10 -08:00
Ryan Liptak
f96ef9780a
SelfInfo.Windows: a few fixes for std.Io
2025-12-23 22:15:10 -08:00
Andrew Kelley
2f30b0f44d
std.Progress.start: handle cancelation from isTty
...
It's important not to swallow error.Canceled. We don't have recancel()
yet but that will be a way to "rearm" cancelation after handling it so
that it is not ignored.
2025-12-23 22:15:10 -08:00
Ryan Liptak
406950f756
std.process: Fix executableDirPath functions
2025-12-23 22:15:10 -08:00
Ryan Liptak
8767a9a6d1
testFilenameLimits: Fix collision with dir and filename
2025-12-23 22:15:10 -08:00
Andrew Kelley
c1b9c46319
std.Io: introduce path_only to File.OpenFlags
2025-12-23 22:15:10 -08:00
Andrew Kelley
f27bd87ade
std.Io.Threaded: allow length-0 file writes
...
At first I thought about keeping this as an assertion but I can see this
being useful if you already know how many bytes to read and you are
filling the end of the buffer.
This also more closely mirrors POSIX APIs.
2025-12-23 22:15:10 -08:00
Andrew Kelley
6f00157e1e
std: fix "open smoke test" by passing allow_directory option
2025-12-23 22:15:10 -08:00
Andrew Kelley
47a2e8026f
std.Io.Threaded: fix dirDeleteDir when not empty
2025-12-23 22:15:10 -08:00
Andrew Kelley
651ff9f9ee
std.Io.Threaded: implement dirHardLink
2025-12-23 22:15:10 -08:00
Andrew Kelley
7ce5ee2e92
std: update remaining unit tests for std.Io API changes
2025-12-23 22:15:10 -08:00
Andrew Kelley
21d0264c61
std.dynamic_library: use a global static single threaded Io
...
See #30150
2025-12-23 22:15:10 -08:00
Andrew Kelley
8632a28ca9
std: add support for realpath on file handle
...
and rename OperationNotSupported to OperationUnsupported
2025-12-23 22:15:10 -08:00
Andrew Kelley
9bbb8e0d8e
std.posix: make nlink_t on unsupported systems u0
...
instead of void
2025-12-23 22:15:10 -08:00
Ryan Liptak
f078c7138f
std: Update/fix some usages/implementations of std.Io APIs
2025-12-23 22:15:10 -08:00
Ryan Liptak
1edae601a1
Test Dir.Reader.min_buffer_len via "max file name component lengths" test
2025-12-23 22:15:10 -08:00
Andrew Kelley
3466056478
std.Io.Dir.CopyFileOptions: rename override_permissions
...
to more simply `permissions`.
In master branch this was `override_mode`.
2025-12-23 22:15:10 -08:00
Andrew Kelley
d8b1cc953e
std.Io.Dir.renameAbsolute: consistent parameter order
2025-12-23 22:15:10 -08:00
Andrew Kelley
e205b13ffb
std.os.linux.IoUring: update for new fs API
...
and split out tests into a separate file
2025-12-23 22:15:10 -08:00
Andrew Kelley
b4bfd501ae
std: move some tests from posix to fs
2025-12-23 22:15:10 -08:00
Andrew Kelley
f3723b42e1
std.Io: add unimplemented hard link API to File and Dir
2025-12-23 22:15:10 -08:00