aboutsummaryrefslogtreecommitdiff
path: root/lib/std
AgeCommit message (Collapse)Author
2025-08-08std.Io.Writer.Allocating: configurable bump amountAndrew Kelley
2025-08-08zig std: fix build failuresAndrew Kelley
2025-08-08std.Io: remove BufferedWriterAndrew Kelley
2025-08-08std.compress.flate.Decompress: fix buffer size in testAndrew Kelley
2025-08-08compiler: improve error reportingmlugg
The functions `Compilation.create` and `Compilation.update` previously returned inferred error sets, which had built up a lot of crap over time. This meant that certain error conditions -- particularly certain filesystem errors -- were not being reported properly (at best the CLI would just print the error name). This was also a problem in sub-compilations, where at times only the error name -- which might just be something like `LinkFailed` -- would be visible. This commit makes the error handling here more disciplined by introducing concrete error sets to these functions (and a few more as a consequence). These error sets are small: errors in `update` are almost all reported via compile errors, and errors in `create` are reported through a new `Compilation.CreateDiagnostic` type, a tagged union of possible error cases. This allows for better error reporting. Sub-compilations also report errors more correctly in several cases, leading to more informative errors in the case of compiler bugs. Also fixes some race conditions in library building by replacing calls to `setMiscFailure` with calls to `lockAndSetMiscFailure`. Compilation of libraries such as libc happens on the thread pool, so the logic must synchronize its access to shared `Compilation` state.
2025-08-08std.Io.Writer.Allocating.sendFile: use logicalPosAndrew Kelley
fixes #24754 tested with `zig build test-std -Dskip-release`
2025-08-08Io.Writer fix dangling pointerIgor Anić
While underlying writer is Allocating writer buffer can grow in vtable.drain call. We should not hold pointer to the buffer before that call and use it after. This remembers positions instead of holding reference.
2025-08-08Fix: std.elf offset computationGiuseppe Cesarano
2025-08-08Merge pull request #24740 from ziglang/http-plus-fixesAndrew Kelley
fetch, tls, and http fixes
2025-08-08Merge pull request #24742 from ziglang/CountingWriterAndrew Kelley
std.Io: delete CountingWriter
2025-08-08Io.Reader fix defaultReadVecIgor Anić
Running tar.pipeToFileSystem compressed_mingw_includes.tar file from #24732 finishes in infinite loop calling defaultReadVec with: r.seek = 1024 r.end = 1024 r.buffer.len = 1024 first.len = 512 that combination calls vtable.stream with 0 capacity writer and loops forever. Comment is to use whichever has larger capacity, and this fix reflects that.
2025-08-08flate: Handle invalid block typeRyan Liptak
Fixes `panic: invalid enum value` when the type bits had the u2 value of 3. Contributes towards #24741
2025-08-07link.Dwarf: minimal changes to remove CountingWriterAndrew Kelley
2025-08-07std.Io: delete CountingWriterAndrew Kelley
2025-08-08std.os.windows: map RtlGenRandom() failure to error.SystemResourcesAlex Rønne Petersen
Closes #23666.
2025-08-07Merge pull request #24661 from alichraghi/spv4Andrew Kelley
spirv: refactor and remove deduplication ISel
2025-08-07std.crypto.tls.Client: always write to bufferAndrew Kelley
simplifies the logic & makes it respect limit
2025-08-07std.http.bodyReader: add missing flush in endUnflushedAndrew Kelley
It's a bit counter-intuitive, but there are two streams here: the implementation here, and the connected output stream. When we say "unflushed" we mean don't flush the connected output stream because that's managed externally. But an "end" operation should always flush the implementation stream.
2025-08-07Fetch: handle compressed git+httpAndrew Kelley
2025-08-07std.http.Client: fix fetching by adding a bufferAndrew Kelley
2025-08-07Merge pull request #24698 from ziglang/httpAndrew Kelley
std: rework HTTP and TLS for new I/O API
2025-08-08Fix some libc version checks for BionicTibboddiT
2025-08-07std/zip.zig: perform backslash-to-forward-slash before isBadFilename()Frank Denis
Previously, when extracting a ZIP file, isBadFilename(), which is designed to reject ../ patterns to prevent directory traversal, was called before normalizing backslashes to forward slashes. This allowed path traversal sequences like ..\\..\\..\\etc\\passwd which pass validation but are then converted to ../../../etc/passwd for file extraction.
2025-08-07flate change bit reader Bits to usize (#24719)Igor Anić
Don't see why byte returned from specialPeek needs to be shifted by remaining_needed_bits. I believe that decision in specialPeek should be done on the number of the remaining bits not of the content of that bits. Some test result are changed, but they are now consistent with the original state as found in: https://github.com/ziglang/zig/blame/5f790464b0d5da3c4c1a7252643e7cdd4c4b605e/lib/std/compress/flate/Decompress.zig Changing Bits from usize to u32 or u64 now returns same results. * flate: simplify peekBitsEnding `peekBits` returns at most asked number of bits. Fails with EndOfStream when there are no available bits. If there are less bits available than asked still returns that available bits. Hopefully this change better reflects intention. On first input stream peek error we break the loop.
2025-08-07TLS, HTTP, and package fetching fixesAndrew Kelley
* TLS: add missing assert for output buffer length requirement * TLS: add missing flushes * TLS: add flush implementation * TLS: finish drain implementation * HTTP: correct buffer sizes for TLS * HTTP: expose a getReadError method on Connection * HTTP: add missing flush on sendBodyComplete * Fetch: remove unwanted deinit * Fetch: improve error reporting
2025-08-07std.fs.File.Reader: fix readVec fillAndrew Kelley
respect the case when there is existing buffer
2025-08-07std.http: remove custom method supportAndrew Kelley
let's see if anybody notices it missing
2025-08-07std.http: address review commentsAndrew Kelley
thank you everybody
2025-08-07std.http.Server: add safety for invalidated Head stringsAndrew Kelley
and fix bad unit test API usage that it finds
2025-08-07std.Io: delete LimitedReaderAndrew Kelley
2025-08-07std.Io: delete BufferedReaderAndrew Kelley
2025-08-07remove std.fifoAndrew Kelley
I never liked how this data structure took its API as a parameter. This use case is now served by std.Io buffering.
2025-08-07std.net: fix windows buildAndrew Kelley
2025-08-07fix 32-bit buildsAndrew Kelley
2025-08-07std.Io.Reader: fix appendRemainingUnlimitedAndrew Kelley
Now it avoids mutating `r` unnecessarily, allowing the `ending` Reader to work.
2025-08-07fetch: update for new http APIAndrew Kelley
it's not quite finished because I need to make it not copy the Resource
2025-08-07update build system to new http.Server APIAndrew Kelley
2025-08-07http fixesAndrew Kelley
2025-08-07std.crypto.tls: rework for new std.Io APIAndrew Kelley
2025-08-07std.http: rework for new std.Io APIAndrew Kelley
2025-08-07Merge pull request #24709 from rootbeer/24380-fstatat-race-fixAlex Rønne Petersen
2025-08-07std: fix std.c._msize signatureMeghan Denny
2025-08-07Add support for both '_' and 'else' prongs at the same time in switch statementsJustus Klausecker
If both are used, 'else' handles named members and '_' handles unnamed members. In this case the 'else' prong will be unrolled to an explicit case containing all remaining named values.
2025-08-07Permit explicit tags with '_' switch prongJustus Klausecker
Mainly affects ZIR representation of switch_block[_ref] and special prong (detection) logic for switch. Adds a new SpecialProng tag 'absorbing_under' that allows specifying additional explicit tags in a '_' prong which are respected when checking that every value is handled during semantic analysis but are not transformed into AIR and instead 'absorbed' by the '_' branch.
2025-08-07Merge pull request #24199 from Justus2308/24106-fmt-castsMatthew Lugg
zig fmt: canonicalize nested cast builtin order
2025-08-06lib/std/posix/test.zig: don't compare blksize in "fstatat"Pat Tullmann
In trying to reproduce the race in #24380, my system tripped over the stat "blocks" field changing in this test. The value was almost always 8 (effectively 4k) or very infrequently 0 (I saw the 0 from both `fstat` and `fstatat`). I believe the underlying filesystem is free to asynchronously change this value. For example, if it migrates a file between some "inline" or maybe journal storage, and actual on-disk blocks. So it seems plausible that its allowed to change between stat calls. Breaking up the struct comparison this way means we also don't compare any of the padding or "reserved" fields, too. And we can narrow down the s390x-linux work-around.
2025-08-06linux/mips.zig: Use `i32` for stat nsec fieldsPat Tullmann
The `atime()`, etc wrappers here expect to create a `std.linux.timespec` (defined in `linux.zig` to have `isize` fields), so the u32 causes errors: error: expected type 'isize', found 'u32' .nsec = self.atim_nsec, Make the nsec fields signed for consistency with all the other structs, with and with `std.linux.timespec`. Also looks like the comment on `__pad1` was copied from `__pad0`, but it only applies to `__pad0`.
2025-08-06std.Io.Reader: use readVec for fill functionsAndrew Kelley
readVec has two updated responsibilities: 1. it must respect any existing already buffered data. 2. it must write to the buffer if data is empty
2025-08-06#24471: add mlock syscalls to std.os.linuxkj4tmp@gmail.com
2025-08-05flate zlib fix end of block readingIgor Anić
`n` is wanted number of bits to toss `buffered_n` is actual number of bytes in `next_int`