Maciej 'vesim' Kuliński
e5a55f6144
std: std.fs.File fix sendFile with buffered data
...
fixes #25196
Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2025-10-08 17:14:03 -07:00
Andrew Kelley
889942a8b7
std: fix sendFileReading not accounting for buffer
...
Related to 1d764c1fdf04829cec5974d82cec901825a80e49
Test case provided by:
Co-authored-by: Kendall Condon <goon.pri.low@gmail.com>
2025-10-08 16:45:38 -07:00
Andrew Kelley
4c27eeff8e
std: fix File.Writer sendfile with buffered contents
...
* File.Writer.seekBy passed wrong offset to setPosAdjustingBuffer.
* File.Writer.sendFile incorrectly used non-logical position.
Related to 1d764c1fdf04829cec5974d82cec901825a80e49
Test case provided by:
Co-authored-by: Kendall Condon <goon.pri.low@gmail.com>
2025-10-08 16:43:42 -07:00
rpkak
bc512648db
use copy_file_range syscall on linux
2025-09-24 03:08:12 +02:00
Andrew Kelley
1d764c1fdf
Revert "Merge pull request #24905 from gooncreeper/file-reader-buffered"
...
This reverts commit ac42eaaadd0650ffc281f9a1ed1a642fde8984b7, reversing
changes made to 9fa2394f8c00d060931d69fb6f342f7f2e3d826e.
I would like a chance to review this, please. I already spotted some
issues.
2025-09-05 11:26:38 -07:00
Isaac Freund
ac42eaaadd
Merge pull request #24905 from gooncreeper/file-reader-buffered
...
Fix Io.Writer sendFile bugs with buffered reader contents
2025-09-05 16:28:08 +02:00
Andrew Kelley
f78f70dbd8
std.fs.File.Writer: break up seekTo
...
- introduce seekToUnbuffered which asserts no buffered data and does not
have WriteFailed in the error set
- remove WriteFailed from SeekError
- make seekTo based on calling flush and then seekToUnbuffered
- revert the change to reset seek_err since the error sets are
compatible again
2025-09-04 16:05:55 -07:00
Kendall Condon
58dda3b10b
fix sendFile implementations bypassing interface buffer
...
Also removes `File.Reader.read` since it is otherwise unused and is a
footgun.
2025-09-04 17:26:49 -04:00
Kendall Condon
7687b916fd
File.Writer.sendFile: properly update reader pos
...
seekBy affects the reader's physical position, not its logical
position.
2025-09-04 16:38:50 -04:00
Josh GM Walker
b1189ab038
fix: std.fs.File.Writer.seekTo does not flush ( #25135 )
...
* add failing test case
* perform flush and allow error
* dont over constrain flush error
* reset seek error during conversion
2025-09-03 21:43:47 -07:00
Andrew Kelley
79f267f6b9
std.Io: delete GenericReader
...
and delete deprecated alias std.io
2025-08-29 17:14:26 -07:00
Andrew Kelley
57dbc9e74a
std.Io: delete GenericWriter
2025-08-28 18:30:57 -07:00
Carl Åstholm
172e97154d
Use readStreaming, not readPositional, for streaming file readVec on Windows
2025-08-20 21:49:07 +02:00
Carl Åstholm
9e9cb3ad6d
Fix bugs in Windows readVec implementations
2025-08-19 16:18:02 -07:00
Andrew Kelley
ef14c73245
Compilation: remove last instance of deprecatedReader
...
This also makes initStreaming preemptively disable file size checking.
2025-08-16 14:46:20 -07:00
Andrew Kelley
e395c24c6d
std.fs.File.Reader: fix freestanding build failures
...
This should be enough to unblock people for now. We'll revisit the way
these things are organized with the upcoming std.Io interface.
fixes #24685
2025-08-14 23:10:29 -07:00
Andrew Kelley
6bcdcf85c7
std.fs.File.Writer.sendFile: handle sendfile errors
...
fixes #24842
2025-08-13 22:16:08 -07:00
Andrew Kelley
5e986fef1f
std.fs.File.Reader: fix seekBy
...
Tested locally:
stage3/bin/zig build test -Dskip-release -Dskip-non-native
closes #24495
closes #24498
closes #24713
2025-08-13 12:24:14 -07:00
Andrew Kelley
749f10af49
std.ArrayList: make unmanaged the default
2025-08-11 15:52:49 -07:00
Andrew Kelley
282c3575b1
std.fs.File: prefer getSize over getEndPos
...
The former detects when it is appropriate to switch to streaming mode.
closes #24798
2025-08-11 12:27:52 -07:00
Andrew Kelley
b9a6dae2ae
std.fs.File.Reader.getSize: check file kind on stat
...
closes #24794
2025-08-10 17:51:22 -07:00
Andrew Kelley
e667884f9b
std.net.Stream.Reader: init size_err
...
This code knows in advance that stat() should never be called.
closes #24754
2025-08-10 17:38:46 -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
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
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
Andrew Kelley
111305678c
std: match readVec fn prototype exactly
...
this is not necessary according to zig language, but works around a flaw
in the C backend
2025-07-31 22:10:11 -07:00
Andrew Kelley
f3a38e30fa
std.Io: delete SeekableStream
...
Alternative is to use File.Reader and File.Writer directly.
2025-07-31 22:10:11 -07:00
Andrew Kelley
cf7a28febb
std.Io.Reader: introduce readVec back into the VTable
...
simplifies and fixes things
addresses a subset of #24608
2025-07-30 09:26:34 -07:00
Andrew Kelley
733b208256
std.posix.ftruncate: handle NonResizable properly
2025-07-25 14:15:33 -07:00
Andrew Kelley
da51e94d50
std.fs.File.end: account for streaming mode
2025-07-25 14:15:33 -07:00
Jacob Young
5060ab99c9
aarch64: add new from scratch self-hosted backend
2025-07-22 19:43:47 -07:00
Andrew Kelley
34d2778239
std.fs.File.Reader.sendFile: fix 32-bit freebsd
2025-07-22 09:39:24 -07:00
Andrew Kelley
76fe518d49
std.fs.File.Reader.sendFile: fix EndOfStream detection
2025-07-21 23:33:19 -07:00
Andrew Kelley
96cbdd145d
std.fs.File.Reader: fix sendFile logic
...
it wasn't accounting for both writer and reader buffering
2025-07-21 20:00:45 -07:00
Andrew Kelley
b35c55e237
std.fs.File.Reader: fix seek position logic
2025-07-21 18:14:21 -07:00
Andrew Kelley
fe10c66d66
std.fs.File.Reader: only fcopyfile if size available
2025-07-21 12:32:37 -07:00
Andrew Kelley
f1576ef14c
objcopy: delete most of it
...
this code is not up to zig project standards
tracked by #24522
oh, and fix not adjusting buffer seek position in std.fs.File.Reader
2025-07-21 12:32:37 -07:00
Andrew Kelley
f2a3ac7c05
std.fs.File: delete writeFileAll and friends
...
please use File.Writer for these use cases
also breaking API changes to std.fs.AtomicFile
2025-07-21 12:32:37 -07:00
Andrew Kelley
9abc3232a8
std.fs.File.Reader: fix missed advance writer positions
2025-07-21 13:08:43 +02:00
Andrew Kelley
b510482525
std.fs.File.Reader.seekTo: add missing int cast
2025-07-14 00:21:20 -07:00
Atlas Yu
2cda4cfb39
std.posix.send: should expect ConnectionRefused
...
Closes : #20219
2025-07-11 13:06:13 +02:00
Andrew Kelley
55bced9563
std.fs.File.Writer: fix splat alias bug
...
same deal as previous commit
2025-07-09 20:01:15 -07:00
Andrew Kelley
5955ba4f53
std.fs.File.Writer: implement positional writing for Windows
2025-07-07 23:09:14 -07:00
Andrew Kelley
f2ad3bcc1c
fix 32-bit compilation
2025-07-07 22:43:53 -07:00
Andrew Kelley
fd7feed04b
std.fs.File.Writer: implement positional writing
2025-07-07 22:43:53 -07:00
Andrew Kelley
4ccc6f2b57
compiler: fix remaining build failures
2025-07-07 22:43:53 -07:00
Andrew Kelley
6489907662
std.zip: work around deprecated API
2025-07-07 22:43:53 -07:00
Andrew Kelley
cce32bd1d5
fix build runner
2025-07-07 22:43:52 -07:00
Andrew Kelley
f71d97e4cb
update compiler source to new APIs
2025-07-07 22:43:52 -07:00