553 Commits

Author SHA1 Message Date
Andrew Kelley
f7bbcb4a4b fix miscellaneous compilation failures 2025-10-29 06:20:50 -07:00
Andrew Kelley
c2d1a339da std.fs.File: begrudgingly add back deprecated APIs
I'm not ready to rework MachO linker file access at the moment.
2025-10-29 06:20:49 -07:00
Andrew Kelley
7d478114ec fix compilation errors introduced by rebasing 2025-10-29 06:20:49 -07:00
Andrew Kelley
b1733b7bce std.Io: implement dirOpenFile 2025-10-29 06:20:49 -07:00
Andrew Kelley
8a1e6c8c39 std.Io: implement dirStatPath 2025-10-29 06:20:49 -07:00
Andrew Kelley
750b1431bf std: fix some Io compilation errors 2025-10-29 06:20:49 -07:00
Andrew Kelley
ebcc6f166c std.Io: bring back Timestamp but also keep Clock.Timestamp
this feels better
2025-10-29 06:20:49 -07:00
Andrew Kelley
89412fda77 std.Io: implement fileStat 2025-10-29 06:20:48 -07:00
Andrew Kelley
47aa5a70a5 std: updating to std.Io interface
got the build runner compiling
2025-10-29 06:20:48 -07:00
Andrew Kelley
b428612a20 WIP: hack away at std.Io return flight 2025-10-29 06:20:48 -07:00
Andrew Kelley
774df26835 WIP: hack at std.Io on a plane 2025-10-29 06:20:48 -07:00
Andrew Kelley
00f26cb0a4 WIP land the std.Io interface
fix std lib compilation errors caused by introducing std.Io
2025-10-29 06:20:48 -07:00
Andrew Kelley
0e9280ef1a std.Io: extract Dir to separate file 2025-10-29 06:20:48 -07:00
Andrew Kelley
e7729a7b89 std: start moving fs.File to Io 2025-10-29 06:20:48 -07:00
Alex Rønne Petersen
dba1bf9353 remove all Oracle Solaris support
There is no straightforward way for the Zig team to access the Solaris system
headers; to do this, one has to create an Oracle account, accept their EULA to
download the installer ISO, and finally install it on a machine or VM. We do not
have to jump through hoops like this for any other OS that we support, and no
one on the team has expressed willingness to do it.

As a result, we cannot audit any Solaris contributions to std.c or other
similarly sensitive parts of the standard library. The best we would be able to
do is assume that Solaris and illumos are 100% compatible with no way to verify
that assumption. But at that point, the solaris and illumos OS tags would be
functionally identical anyway.

For Solaris especially, any contributions that involve APIs introduced after the
OS was made closed-source would also be inherently more risky than equivalent
contributions for other proprietary OSs due to the case of Google LLC v. Oracle
America, Inc., wherein Oracle clearly demonstrated its willingness to pursue
legal action against entities that merely copy API declarations.

Finally, Oracle laid off most of the Solaris team in 2017; the OS has been in
maintenance mode since, presumably to be retired completely sometime in the 2030s.

For these reasons, this commit removes all Oracle Solaris support.

Anyone who still wishes to use Zig on Solaris can try their luck by simply using
illumos instead of solaris in target triples - chances are it'll work. But there
will be no effort from the Zig team to support this use case; we recommend that
people move to illumos instead.
2025-10-27 07:35:38 -07:00
Techatrix
bd1e960bc0 fix std.fs.path.resolveWindows on UNC paths with mixed path separators 2025-10-26 02:18:11 +02:00
usebeforefree
62e3d46287 replaced https://simonsapin.github.io/wtf-8/ with https://wtf-8.codeberg.page/ 2025-10-10 23:53:00 +02:00
Ryan Liptak
d629a146f5 Dir.realpathW: remove redundant buffer/copy
This same change was applied in 69007f096177143086e28da0dc1a0eff4efcc52c but accidentally reverted in 7bf740ee718f4b6109cd9fe7014d1784d48ada48
2025-10-10 12:13:35 -07:00
Andrew Kelley
df712d0833 std.fs.File.Reader.seekTo: fix one more logical position bug 2025-10-09 11:59:53 -07:00
Andrew Kelley
529aa9f270
Merge pull request #25512 from ziglang/sendfile-fixes
std.Io: Writer and Reader bug fixes related to sendFile, delimiters, Limited, and seeking
2025-10-09 02:30:31 -07:00
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
Michael Pfaff
7bf740ee71 Deprecate old realpathW correctly
- Rename modified `realpathW` to `realpathW2`
- Re-add original `realpathW`
- Add deprecation notice to `realpathW`
2025-10-08 17:07:38 -07:00
Michael Pfaff
a7dfc6470f Reuse pathname_w buffer as out_buffer when calling realpathW 2025-10-08 17:07:38 -07:00
Michael Pfaff
2886a8bf45 Improve documentation on Dir.realpathW 2025-10-08 17:07:38 -07:00
Michael Pfaff
f2227ae677 Return WTF16LE encoded path from realpathW 2025-10-08 17:07:38 -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
Ryan Liptak
894a991714 Add depth function to Walker.Entry
This enables depth-related use cases without any dependency on the Walker's internal stack which doesn't always pertain to the actual depth of the current entry (i.e. recursing into a directory immediately affects the stack).
2025-10-03 16:29:09 -07:00
Henry Kupty
7bee39c1fd test: enter after check to preserve depth 2025-10-03 16:29:08 -07:00
Henry Kupty
a26a654c55 test: Include expected depth test 2025-10-03 16:29:08 -07:00
Henry Kupty
df394faf77 feat: Reintroduce depth
Some decision-making might depend on the level of the traversal, so
it makes sense to expose depth here since it's stable, and not in the
automatic walker where it's not.
2025-10-03 16:29:08 -07:00
Ryan Liptak
760127a760 Add SelectiveWalker/walkSelectively and implement Walker in terms of it
This is a breaking change, since the fields of Walker have changed. The function APIs are unchanged, though.
2025-10-03 16:29:08 -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
150169f1e0 std.fmt: delete deprecated APIs
std.fmt.Formatter -> std.fmt.Alt
std.fmt.format -> std.Io.Writer.print
2025-08-31 12:49:18 -07:00
Andrew Kelley
9a0970a12b rework std.Io.Writer.Allocating to support runtime-known alignment
Also, breaking API changes to:
* std.fs.Dir.readFileAlloc
* std.fs.Dir.readFileAllocOptions
2025-08-30 00:48:50 -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
Alex Rønne Petersen
77c09d16f9 std.fs.Dir: fix updateFile() to flush the file before updating its times
AtomicFile.finish() calls flush() which renders any previous updateTimes() calls
useless. Regression introduced in f2a3ac7c0534a74ee544fdf6ef9d2176a8d62389.

Closes #24927.
2025-08-23 12:32:14 -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