Commit graph

12745 commits

Author SHA1 Message Date
Alex Rønne Petersen
0d0f09fb0e std.os.windows: map RtlGenRandom() failure to error.SystemResources
Closes #23666.
2025-08-08 07:25:26 +02:00
Andrew Kelley
3fb86841cc
Merge pull request #24661 from alichraghi/spv4
spirv: refactor and remove deduplication ISel
2025-08-07 20:55:50 -07:00
Andrew Kelley
8721efece4 std.crypto.tls.Client: always write to buffer
simplifies the logic & makes it respect limit
2025-08-07 19:55:40 -07:00
Andrew Kelley
6244f5c6cb std.http.bodyReader: add missing flush in endUnflushed
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-07 19:55:40 -07:00
Andrew Kelley
af2ac24333 Fetch: handle compressed git+http 2025-08-07 19:55:40 -07:00
Andrew Kelley
5ce8e9325b std.http.Client: fix fetching by adding a buffer 2025-08-07 19:54:39 -07:00
Andrew Kelley
5998a8cebe
Merge pull request #24698 from ziglang/http
std: rework HTTP and TLS for new I/O API
2025-08-07 19:54:25 -07:00
TibboddiT
2cf15bee03
Fix some libc version checks for Bionic 2025-08-08 01:26:00 +00:00
Frank Denis
242102f9d1 std/zip.zig: perform backslash-to-forward-slash before isBadFilename()
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-07 14:42:48 -07:00
Igor Anić
6de2310035
flate change bit reader Bits to usize (#24719)
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:
5f790464b0/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-07 14:40:08 -07:00
Andrew Kelley
46b34949c3 TLS, HTTP, and package fetching fixes
* 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-07 10:04:52 -07:00
Andrew Kelley
172d31b0e2 std.fs.File.Reader: fix readVec fill
respect the case when there is existing buffer
2025-08-07 10:04:52 -07:00
Andrew Kelley
163a827826 std.http: remove custom method support
let's see if anybody notices it missing
2025-08-07 10:04:52 -07:00
Andrew Kelley
6b411f147c std.http: address review comments
thank you everybody
2025-08-07 10:04:52 -07:00
Andrew Kelley
618a435ad4 std.http.Server: add safety for invalidated Head strings
and fix bad unit test API usage that it finds
2025-08-07 10:04:52 -07:00
Ryan Liptak
858716aa4d resinator: a few more updates/fixes
Just enough to get things working correctly again
2025-08-07 10:04:52 -07:00
Andrew Kelley
5a743be6b4 resinator: just enough fixes to make it compile 2025-08-07 10:04:52 -07:00
Andrew Kelley
262bfc5826 std.Io: delete LimitedReader 2025-08-07 10:04:52 -07:00
Andrew Kelley
e061445fc2 std.Io: delete BufferedReader 2025-08-07 10:04:52 -07:00
Andrew Kelley
366884ab06 remove std.fifo
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-07 10:04:52 -07:00
Andrew Kelley
3f8ed5504e std.net: fix windows build 2025-08-07 10:04:52 -07:00
Andrew Kelley
3837862e52 fix 32-bit builds 2025-08-07 10:04:52 -07:00
Andrew Kelley
abd76938cb std.Io.Reader: fix appendRemainingUnlimited
Now it avoids mutating `r` unnecessarily, allowing the `ending` Reader
to work.
2025-08-07 10:04:52 -07:00
Andrew Kelley
9e5048c3a5 fetch: update for new http API
it's not quite finished because I need to make it not copy the Resource
2025-08-07 10:04:51 -07:00
Andrew Kelley
fef41c66db update build system to new http.Server API 2025-08-07 10:04:29 -07:00
Andrew Kelley
e2d81bf6c0 http fixes 2025-08-07 10:04:29 -07:00
Andrew Kelley
28190cc404 std.crypto.tls: rework for new std.Io API 2025-08-07 10:04:29 -07:00
Andrew Kelley
02908a2d8c std.http: rework for new std.Io API 2025-08-07 10:04:28 -07:00
Alex Rønne Petersen
8843631f7e
Merge pull request #24709 from rootbeer/24380-fstatat-race-fix 2025-08-07 16:36:52 +02:00
Meghan Denny
63c5329156 std: fix std.c._msize signature 2025-08-07 16:02:52 +02:00
Justus Klausecker
ba549a7d67 Add support for both '_' and 'else' prongs at the same time in switch statements
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-07 13:58:47 +02:00
Justus Klausecker
1d9b1c0212 Permit explicit tags with '_' switch prong
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-07 13:57:57 +02:00
Matthew Lugg
fd9cfc39f5
Merge pull request #24199 from Justus2308/24106-fmt-casts
zig fmt: canonicalize nested cast builtin order
2025-08-07 10:55:03 +01:00
Pat Tullmann
cf47d283d1 lib/std/posix/test.zig: don't compare blksize in "fstatat"
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-06 22:12:42 -07:00
Pat Tullmann
caf80e90b8 linux/mips.zig: Use i32 for stat nsec fields
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-06 22:12:41 -07:00
Andrew Kelley
04fe1bfe3c std.Io.Reader: use readVec for fill functions
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 21:23:06 -07:00
kj4tmp@gmail.com
44ea11d71f #24471: add mlock syscalls to std.os.linux 2025-08-06 12:18:45 +02:00
massi
9a158c1dae
autodoc: Use the search input's value on load (#24467)
Co-authored-by: massi <git@massi.world>
2025-08-06 03:23:24 +00:00
Igor Anić
d2149106a6 flate zlib fix end of block reading
`n` is wanted number of bits to toss
`buffered_n` is actual number of bytes in `next_int`
2025-08-05 17:09:41 -07:00
Andrew Kelley
d8cecffe31
Merge pull request #24699 from ziglang/bounded
remove RingBuffer; remove BoundedArray; use `@memmove`
2025-08-05 16:24:28 -07:00
Giuseppe Cesarano
3914eaf357
std.elf: buffer header iterator API (#24691)
Closes #24666.
2025-08-05 10:00:33 -07:00
Andrew Kelley
8c11ada66c std: delete RingBuffer
Progress towards #19231
2025-08-05 09:56:02 -07:00
Andrew Kelley
b6f84c47c4 std.base64: delete encodeFromReaderToWriter
this function is wacky, should not have been merged
2025-08-05 09:56:02 -07:00
Andrew Kelley
196e36bbb2 std: remove BoundedArray
This use case is handled by ArrayListUnmanaged via the "...Bounded"
method variants, and it's more optimal to share machine code, versus
generating multiple versions of each function for differing array
lengths.
2025-08-05 09:56:02 -07:00
Andrew Kelley
c47ec4f3d7 std.array_list: add bounded methods 2025-08-05 09:56:02 -07:00
Andrew Kelley
6f545683f3 std: replace various mem copies with @memmove 2025-08-05 09:56:02 -07:00
Veikka Tuominen
82961a8c9f std.c: fix utsname array sizes 2025-08-05 00:18:14 -07:00
David Rubin
def25b9189 crypto: fix typo in ecdsa comment 2025-08-05 07:51:39 +01:00
KNnut
fcb088cb6a std.Target.Query: fix WindowsVersion format in zigTriple() 2025-08-05 06:08:42 +02:00
Ian Johnson
96be6f6566 std.compress.flate.Decompress: return correct size for unbuffered decompression
Closes #24686

As a bonus, this commit also makes the `git.zig` "testing `main`" compile again.
2025-08-04 19:32:14 -07:00