Commit Graph

12697 Commits

Author SHA1 Message Date
Andrew Kelley 52ba2a4c72 std.Io.Threaded: don't assume dirents are aligned
Linux kernel seems to do it but qemu user mode seems not to.
2025-12-23 22:15:11 -08:00
Andrew Kelley 6cfd2df695 don't skip test for closed issue 2025-12-23 22:15:11 -08:00
Andrew Kelley bf81666beb std.fs.test: don't try to test nonexistent API 2025-12-23 22:15:11 -08:00
Andrew Kelley 88110139fe std.Io.Threaded: fix NetBSD compilation 2025-12-23 22:15:11 -08:00
Andrew Kelley 4025af9c05 std.Io.Threaded: fix fchmodat on linux with libc 2025-12-23 22:15:11 -08:00
Andrew Kelley 6aa31cedb7 std.Io.Dir.Reader: fix min_buffer_len on 32-bit linux
dirents64 still uses 8 byte alignment on 32-bit systems
2025-12-23 22:15:11 -08:00
Andrew Kelley 3e624e17a4 std: fix compilation errors on FreeBSD 2025-12-23 22:15:11 -08:00
Andrew Kelley 405db921dc std: fix compilation targeting WASI 2025-12-23 22:15:11 -08:00
Andrew Kelley 1381f9f612 std.debug: fix printLineFromFile
by using streamDelimiter and discardDelimiter functions that don't
depend on the buffer size being large enough
2025-12-23 22:15:11 -08:00
Andrew Kelley ac11b82738 std.Io.Threaded: fix splat buffer calculations 2025-12-23 22:15:11 -08:00
Andrew Kelley d060cb8cd6 std: fix test "max file name component lengths" 2025-12-23 22:15:11 -08:00
Andrew Kelley 002d444964 std: fix Io.Dir.min_buffer_len on Linux 2025-12-23 22:15:11 -08:00
Andrew Kelley 018e34271f std.fs.test: fix rebase conflicts 2025-12-23 22:15:11 -08:00
Ryan Liptak 3431f45031 std: Enough fixes to get things compiling on Windows 2025-12-23 22:15:11 -08:00
Ryan Liptak 1136d36362 windows: Remove BadPathName from error set of GetFinalPathNameByHandle
These validations are really only checking for kernel/mount manager
bugs, so an assert seems more appropriate.
2025-12-23 22:15:11 -08:00
Andrew Kelley 07c4ea2de0 all comments are notes, and use doc comments where possible 2025-12-23 22:15:11 -08:00
Ryan Liptak edcbd7ed2c os.windows: Add comment explaining why we don't need a separate EX definition for RENAME_INFORMATION 2025-12-23 22:15:10 -08:00
Ryan Liptak b6cde02322 fs tests: Remove references to readLinkW which no longer exists 2025-12-23 22:15:10 -08:00
Ryan Liptak f96ef9780a SelfInfo.Windows: a few fixes for std.Io 2025-12-23 22:15:10 -08:00
Andrew Kelley 2f30b0f44d std.Progress.start: handle cancelation from isTty
It's important not to swallow error.Canceled. We don't have recancel()
yet but that will be a way to "rearm" cancelation after handling it so
that it is not ignored.
2025-12-23 22:15:10 -08:00
Ryan Liptak 406950f756 std.process: Fix executableDirPath functions 2025-12-23 22:15:10 -08:00
Ryan Liptak 8767a9a6d1 testFilenameLimits: Fix collision with dir and filename 2025-12-23 22:15:10 -08:00
Andrew Kelley c1b9c46319 std.Io: introduce path_only to File.OpenFlags 2025-12-23 22:15:10 -08:00
Andrew Kelley f27bd87ade std.Io.Threaded: allow length-0 file writes
At first I thought about keeping this as an assertion but I can see this
being useful if you already know how many bytes to read and you are
filling the end of the buffer.

This also more closely mirrors POSIX APIs.
2025-12-23 22:15:10 -08:00
Andrew Kelley 6f00157e1e std: fix "open smoke test" by passing allow_directory option 2025-12-23 22:15:10 -08:00
Andrew Kelley 47a2e8026f std.Io.Threaded: fix dirDeleteDir when not empty 2025-12-23 22:15:10 -08:00
Andrew Kelley 651ff9f9ee std.Io.Threaded: implement dirHardLink 2025-12-23 22:15:10 -08:00
Andrew Kelley 7ce5ee2e92 std: update remaining unit tests for std.Io API changes 2025-12-23 22:15:10 -08:00
Andrew Kelley 21d0264c61 std.dynamic_library: use a global static single threaded Io
See #30150
2025-12-23 22:15:10 -08:00
Andrew Kelley 8632a28ca9 std: add support for realpath on file handle
and rename OperationNotSupported to OperationUnsupported
2025-12-23 22:15:10 -08:00
Andrew Kelley 9bbb8e0d8e std.posix: make nlink_t on unsupported systems u0
instead of void
2025-12-23 22:15:10 -08:00
Ryan Liptak f078c7138f std: Update/fix some usages/implementations of std.Io APIs 2025-12-23 22:15:10 -08:00
Ryan Liptak 1edae601a1 Test Dir.Reader.min_buffer_len via "max file name component lengths" test 2025-12-23 22:15:10 -08:00
Andrew Kelley 3466056478 std.Io.Dir.CopyFileOptions: rename override_permissions
to more simply `permissions`.

In master branch this was `override_mode`.
2025-12-23 22:15:10 -08:00
Andrew Kelley d8b1cc953e std.Io.Dir.renameAbsolute: consistent parameter order 2025-12-23 22:15:10 -08:00
Andrew Kelley e205b13ffb std.os.linux.IoUring: update for new fs API
and split out tests into a separate file
2025-12-23 22:15:10 -08:00
Andrew Kelley b4bfd501ae std: move some tests from posix to fs 2025-12-23 22:15:10 -08:00
Andrew Kelley f3723b42e1 std.Io: add unimplemented hard link API to File and Dir 2025-12-23 22:15:10 -08:00
Andrew Kelley 446c145ca8 std.Io.Threaded: fix compilation errors on posix 2025-12-23 22:15:10 -08:00
Ryan Liptak a2416c685a Implement dirReadWindows 2025-12-23 22:15:10 -08:00
Ryan Liptak d72983da44 File.OpenFlags: Add allow_directory and default it to true
This is one way of addressing/closing https://github.com/ziglang/zig/issues/16738

Previously, there was a mismatch between the default behaviors on Windows vs other platforms, where Windows was implicitly using .NON_DIRECTORY_FILE for its `openFile` implementation which caused `error.IsDir` when opening a directory, while on other platforms there is no equivalent flag for the `open` syscall. This meant that `openFile` on a path of a directory would fail on Windows but succeed on other platforms.

Adding `allow_directory` to `File.OpenFlags` serves two purposes:

1. It provides a cross-platform way to get the `.NON_DIRECTORY_FILE` behavior in the most efficient available way for the platform (on Windows, no extra syscalls are required, on other systems, an extra `fstat` is required)
2. It allows `statFile` to be implemented on top of `openFile` on Windows while still allowing `statFile` to work on directory paths. Before this commit, `statFile` on a directory path on Windows failed with `error.IsDir`

Note: The second purpose could have been addressed in different ways (bespoke call to NtCreateFile in the `statFile` implementation to avoid passing `NON_DIRECTORY_FILE`, or just never pass `NON_DIRECTORY_FILE` in the `openFile` implementation), so the first purpose is the more relevant/motivating force behind this change.

The default being `true` is intended to cut down on the number of syscalls as much as possible when using the default flags.
2025-12-23 22:15:10 -08:00
Andrew Kelley 1264469a41 compiler: fix build from source on macOS 2025-12-23 22:15:10 -08:00
Andrew Kelley 54865e0483 compiler: fix compilation when linking libc 2025-12-23 22:15:10 -08:00
Andrew Kelley a5b719e9eb compiler: fix build failures from std.Io-fs 2025-12-23 22:15:10 -08:00
Andrew Kelley 608145c2f0 fix more fallout from locking stderr 2025-12-23 22:15:10 -08:00
Andrew Kelley aa57793b68 std: rework locking stderr 2025-12-23 22:15:09 -08:00
Andrew Kelley 97f106f949 std.Io: fix dir iteration on macOS 2025-12-23 22:15:09 -08:00
Andrew Kelley 22afd168d9 fix build runner compilation errors on macOS 2025-12-23 22:15:09 -08:00
Andrew Kelley 9407ad8516 std.c.utimensat: add const 2025-12-23 22:15:09 -08:00
Andrew Kelley 16bd2e137e compiler: fix most compilation errors from std.fs changes 2025-12-23 22:15:09 -08:00