From 255c5a760fa2f48e07544d9ff71a773ecb85f3f4 Mon Sep 17 00:00:00 2001 From: pfg Date: Wed, 18 Jun 2025 20:46:05 -0700 Subject: [PATCH] PermissionDenied, ProcessNotFound, .fromByteUnits --- src/allocators/max_heap_allocator.zig | 2 +- src/bun.js/node/node_fs.zig | 12 ++++++++++++ src/bun.js/node/path_watcher.zig | 2 +- src/multi_array_list.zig | 4 ++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/allocators/max_heap_allocator.zig b/src/allocators/max_heap_allocator.zig index 01c463580d..bf65f5f9d4 100644 --- a/src/allocators/max_heap_allocator.zig +++ b/src/allocators/max_heap_allocator.zig @@ -4,7 +4,7 @@ const std = @import("std"); /// Single allocation only. /// pub const MaxHeapAllocator = struct { - array_list: std.ArrayListAligned(u8, @alignOf(std.c.max_align_t)), + array_list: std.ArrayListAligned(u8, .fromByteUnits(@alignOf(std.c.max_align_t))), fn alloc(ptr: *anyopaque, len: usize, alignment: std.mem.Alignment, _: usize) ?[*]u8 { bun.assert(alignment.toByteUnits() <= @alignOf(std.c.max_align_t)); diff --git a/src/bun.js/node/node_fs.zig b/src/bun.js/node/node_fs.zig index 3bbe2deca5..84dee0b781 100644 --- a/src/bun.js/node/node_fs.zig +++ b/src/bun.js/node/node_fs.zig @@ -6602,6 +6602,8 @@ pub fn zigDeleteTree(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.F error.BadPathName, error.NetworkNotFound, error.DeviceBusy, + error.ProcessNotFound, + error.PermissionDenied, => |e| return e, }; stack.appendAssumeCapacity(.{ @@ -6637,6 +6639,7 @@ pub fn zigDeleteTree(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.F error.BadPathName, error.NetworkNotFound, error.Unexpected, + error.PermissionDenied, => |e| return e, } } @@ -6694,6 +6697,8 @@ pub fn zigDeleteTree(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.F error.BadPathName, error.NetworkNotFound, error.DeviceBusy, + error.PermissionDenied, + error.ProcessNotFound, => |e| return e, }; } else { @@ -6718,6 +6723,7 @@ pub fn zigDeleteTree(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.F error.FileBusy, error.BadPathName, error.NetworkNotFound, + error.PermissionDenied, error.Unexpected, => |e| return e, } @@ -6750,6 +6756,7 @@ fn zigDeleteTreeOpenInitialSubpath(self: std.fs.Dir, sub_path: []const u8, kind_ error.NotDir, error.FileNotFound, error.AccessDenied, + error.PermissionDenied, error.SymLinkLoop, error.ProcessFdQuotaExceeded, error.NameTooLong, @@ -6762,6 +6769,7 @@ fn zigDeleteTreeOpenInitialSubpath(self: std.fs.Dir, sub_path: []const u8, kind_ error.BadPathName, error.DeviceBusy, error.NetworkNotFound, + error.ProcessNotFound, => |e| return e, }; } else { @@ -6775,6 +6783,7 @@ fn zigDeleteTreeOpenInitialSubpath(self: std.fs.Dir, sub_path: []const u8, kind_ error.FileNotFound, error.AccessDenied, + error.PermissionDenied, error.InvalidUtf8, error.InvalidWtf8, error.SymLinkLoop, @@ -6845,6 +6854,8 @@ fn zigDeleteTreeMinStackSizeWithKindHint(self: std.fs.Dir, sub_path: []const u8, error.BadPathName, error.NetworkNotFound, error.DeviceBusy, + error.ProcessNotFound, + error.PermissionDenied, => |e| return e, }; if (cleanup_dir_parent) |*d| d.close(); @@ -6877,6 +6888,7 @@ fn zigDeleteTreeMinStackSizeWithKindHint(self: std.fs.Dir, sub_path: []const u8, error.FileBusy, error.BadPathName, error.NetworkNotFound, + error.PermissionDenied, error.Unexpected, => |e| return e, } diff --git a/src/bun.js/node/path_watcher.zig b/src/bun.js/node/path_watcher.zig index 6a0f33144a..1259e70dc9 100644 --- a/src/bun.js/node/path_watcher.zig +++ b/src/bun.js/node/path_watcher.zig @@ -439,7 +439,7 @@ pub const PathWatcherManager = struct { return .{ .err = .{ .errno = @truncate(@intFromEnum(switch (err) { - error.AccessDenied => bun.sys.E.ACCES, + error.AccessDenied, error.PermissionDenied => bun.sys.E.ACCES, error.SystemResources => bun.sys.E.NOMEM, error.Unexpected, error.InvalidUtf8, diff --git a/src/multi_array_list.zig b/src/multi_array_list.zig index b544d3043d..8ef9495424 100644 --- a/src/multi_array_list.zig +++ b/src/multi_array_list.zig @@ -369,7 +369,7 @@ pub fn MultiArrayList(comptime T: type) type { const other_bytes = gpa.alignedAlloc( u8, - @alignOf(Elem), + .fromByteUnits(@alignOf(Elem)), capacityInBytes(new_len), ) catch { const self_slice = self.slice(); @@ -444,7 +444,7 @@ pub fn MultiArrayList(comptime T: type) type { assert(new_capacity >= self.len); const new_bytes = try gpa.alignedAlloc( u8, - @alignOf(Elem), + .fromByteUnits(@alignOf(Elem)), capacityInBytes(new_capacity), ); if (self.len == 0) {