authorgravatar for zig-codeberg@jan-o-sch.netJan Schlien <zig-codeberg@jan-o-sch.net> 2026-10-09 10:39:47+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-10-10 02:02:30+02:00
log3f3e88e7b455bb458839d0d59eb4c50699aeadbf
tree99cd67266e395543eb59ab338c52b81466b93b69
parent30411c1a5fc8947aa6d430713371cfd77f05285a

std.Io.Threaded: map EACCES from file reads

A read can fail with EACCES on a file that was opened successfully, e.g. procfs entries such as /proc/<pid>/stack check permissions at read time. The readv, preadv and pread switches did not handle it, so it ended up in unexpectedErrno which dumps a stack trace in Debug builds.

1 files changed, 3 insertions(+), 0 deletions(-)

lib/std/Io/Threaded.zig+3
......@@ -10030,6 +10030,7 @@ fn fileReadStreamingPosix(file: File, data: []const []u8) File.ReadStreamingErro
1003010030 if (native_os == .wasi) return error.IsDir; // File operation on directory.
1003110031 return error.NotOpenForReading;
1003210032 },
10033 .ACCES => return syscall.fail(error.AccessDenied),
1003310034 .AGAIN => return syscall.fail(error.WouldBlock),
1003410035 .IO => return syscall.fail(error.InputOutput),
1003510036 .ISDIR => return syscall.fail(error.IsDir),
......@@ -10208,6 +10209,7 @@ fn fileReadPositionalPosix(file: File, data: []const []u8, offset: u64) File.Rea
1020810209 try syscall.checkCancel();
1020910210 continue;
1021010211 },
10212 .ACCES => return syscall.fail(error.AccessDenied),
1021110213 .NXIO => return syscall.fail(error.Unseekable),
1021210214 .SPIPE => return syscall.fail(error.Unseekable),
1021310215 .OVERFLOW => return syscall.fail(error.Unseekable),
......@@ -10242,6 +10244,7 @@ fn fileReadPositionalPosix(file: File, data: []const []u8, offset: u64) File.Rea
1024210244 try syscall.checkCancel();
1024310245 continue;
1024410246 },
10247 .ACCES => return syscall.fail(error.AccessDenied),
1024510248 .NXIO => return syscall.fail(error.Unseekable),
1024610249 .SPIPE => return syscall.fail(error.Unseekable),
1024710250 .OVERFLOW => return syscall.fail(error.Unseekable),