- flatten std.crypto.hash.Sha1 and give it a writable interface that
optimizes splats
- flatten std.hash.crc and give it a writable interface that optimizes
splats
- remove old writer impls from std.crypto
- add fs.File.Writer.moveToReader
- add fs.File.Writer.seekTo
- add std.io.Reader.Hashed and std.io.Writer.Hashed which are
passthrough streams. Instead of passing through to null writer, use
the writable interface implemented directly on hashers which doesn't
have to account for passing through the data.
- add std.io.BufferedWriter.writeSplatAll
- use ArrayList strategically to reduce allocations
- use a BufferedReader to avoid unnecessary memcpy of the certs
- use for loops
- skip certs with invalid magic instead of asserting
and rename std.io.BufferedWriter.writableSlice to writableSliceGreedy
and make writableSlice and writableArray advance the buffer end position
introduce std.io.BufferedWriter.writeSplatLimit but it's unimplemented
remove std.fs.Dir.readFileAllocOptions, replace with more flexible API
readFileIntoArrayList
remove std.fs.File.readToEndAllocOptions, replace with more flexible API
readIntoArrayList
update std.fs.File to new reader/writer API
add helper functions to std.io.Reader.Limit
replace std.io.Writer.FileLen with std.io.Reader.Limit
make offset a type rather than u64 so that it can distinguish between
streaming read and positional read
avoid an unnecessary allocation in std.zig.readSourceFileToEndAlloc when
there is a UTF-16 little endian BOM.
fix splat implementation in std.fs.File
update http.Client, with caveats:
* TODO: only 1 underlying write call
* TODO: don't rely on max_buffers_len exceeding the caller
* TODO: handle splat
update net.Stream API. also make it use WSASend on windows
Btrfs at least supports 16 EiB files (limited in practice to 8EiB by the
Linux VFS code which uses signed 64-bit offsets). So fix the fs.zig test
case to expect either a FileTooBig or success from truncating a file to
8EiB. And test that beyond that size the offset is interpreted as a
negative number.
Fixes#24242
Add a test for std.fs.File's `setEndPos` (which is a simple wrapper around
`std.posix.ftruncate`) to exercise some success and failure paths.
Explicitly check that the `ftruncate` length isn't negative when
interpreted as a signed value. This avoids having to decode overloaded
`EINVAL` errors.
Add errno handling to Windows path to map INVALID_PARAMETER to FileTooBig.
Fixes#22960
This PR consistently maps .ACCES into AccessDenied and .PERM into
PermissionDenied. AccessDenied is returned if the file mode bit
(user/group/other rwx bits) disallow access (errno was `EACCES`).
PermissionDenied is returned if something else denies access (errno was
`EPERM`) (immutable bit, SELinux, capabilities, etc). This somewhat
subtle distinction is a POSIX thing.
Most of the change is updating std.posix Error Sets to contain both
errors, and then propagating the pair up through caller Error Sets.
Fixes#16782
Use error.AccessDenied for permissions (rights) failures on Wasi
(`EACCES`) and error.PermissionDenied (`EPERM`) for systemic failures.
And pass-through underlying Wasi errors (PermissionDenied or AccessDenied)
without mapping.
Windows defines an `ACCESS_DENIED` error code. There is no
PERMISSION_DENIED (or its equivalent) which seems to only exist on POSIX
systems. Fix a couple Windows calls code to return `error.AccessDenied`
for `ACCESS_DENIED` and to stop mapping AccessDenied into
PermissionDenied.
* use `tmp.dir.realpathAlloc()` to get full path into tmpDir instances
* use `testing.allocator` where that simplifies things (vs. manual ArenaAllocator for 1 or 2 allocs)
* Trust `TmpDir.cleanup()` to clean up contained files and sub-trees
* Remove some unnecessary absolute paths (enabling WASI to run the tests)
* Drop some no-longer necessary `[_][]const u8` casts
* Add scopes to reduce `var` usage in favor of `const`