zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 52e06ce4f665b737d86fe6ab4d5d896e844d3eda (tree)
parent 9b177a7d21250b82cd18677c5c71ab04e431120d
Author: Lukas Lalinsky <lukas@lalinsky.com>
Date:   Sat, 18 Apr 2026 09:35:28 +0200

std.Io.Dir: fix incorrect return types in setFileOwner and setTimestampsNow

`setFileOwner` declared `SetOwnerError!void` but its vtable method
returns the wider `SetFileOwnerError!void` (adds `NameTooLong` and
`BadPathName`), so any call through the wrapper fails to compile.

`setTimestampsNow` dispatched to `io.vtable.fileSetTimestamps` with
`(Dir, []const u8, Dir.SetTimestampsOptions)`, but that vtable entry
takes `(File, File.SetTimestampsOptions)`. The intended target is
`dirSetTimestamps`, whose signature matches the call site.

Diffstat:
Mlib/std/Io/Dir.zig | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/std/Io/Dir.zig b/lib/std/Io/Dir.zig @@ -1993,7 +1993,7 @@ pub fn setFileOwner( owner: ?File.Uid, group: ?File.Gid, options: SetFileOwnerOptions, -) SetOwnerError!void { +) SetFileOwnerError!void { return io.vtable.dirSetFileOwner(io.userdata, dir, sub_path, owner, group, options); } @@ -2032,7 +2032,7 @@ pub fn setTimestampsNow( sub_path: []const u8, options: SetTimestampsNowOptions, ) SetTimestampsError!void { - return io.vtable.fileSetTimestamps(io.userdata, dir, sub_path, .{ + return io.vtable.dirSetTimestamps(io.userdata, dir, sub_path, .{ .follow_symlinks = options.follow_symlinks, .access_timestamp = .now, .modify_timestamp = .now,