aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-12-08 19:41:21 -0800
committerAndrew Kelley <andrew@ziglang.org>2025-12-23 22:15:08 -0800
commitebdbbd20ace6e93b581b90075f52946b3832da93 (patch)
tree09fb393f4a4578512ddf4906c7df14df5f6f9255 /src
parent3725f72293c87a73e0c11e74739574c7b78bb53d (diff)
downloadzig-ebdbbd20ace6e93b581b90075f52946b3832da93.tar.gz
zig-ebdbbd20ace6e93b581b90075f52946b3832da93.zip
update makeDir() sites to specify permissions
Diffstat (limited to 'src')
-rw-r--r--src/Compilation.zig22
-rw-r--r--src/Package/Fetch.zig8
-rw-r--r--src/Package/Fetch/git.zig4
-rw-r--r--src/main.zig1
4 files changed, 16 insertions, 19 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 79b2d51635..617421e279 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -2823,12 +2823,9 @@ fn cleanupAfterUpdate(comp: *Compilation, tmp_dir_rand_int: u64) void {
return;
}
const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(tmp_dir_rand_int);
- comp.dirs.local_cache.handle.deleteTree(tmp_dir_sub_path) catch |err| {
- log.warn("failed to delete temporary directory '{s}{c}{s}': {s}", .{
- comp.dirs.local_cache.path orelse ".",
- fs.path.sep,
- tmp_dir_sub_path,
- @errorName(err),
+ comp.dirs.local_cache.handle.deleteTree(io, tmp_dir_sub_path) catch |err| {
+ log.warn("failed to delete temporary directory '{s}{c}{s}': {t}", .{
+ comp.dirs.local_cache.path orelse ".", fs.path.sep, tmp_dir_sub_path, err,
});
};
}
@@ -2847,12 +2844,9 @@ fn cleanupAfterUpdate(comp: *Compilation, tmp_dir_rand_int: u64) void {
tmp_dir.handle.close(io);
whole.tmp_artifact_directory = null;
const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(tmp_dir_rand_int);
- comp.dirs.local_cache.handle.deleteTree(tmp_dir_sub_path) catch |err| {
- log.warn("failed to delete temporary directory '{s}{c}{s}': {s}", .{
- comp.dirs.local_cache.path orelse ".",
- fs.path.sep,
- tmp_dir_sub_path,
- @errorName(err),
+ comp.dirs.local_cache.handle.deleteTree(io, tmp_dir_sub_path) catch |err| {
+ log.warn("failed to delete temporary directory '{s}{c}{s}': {t}", .{
+ comp.dirs.local_cache.path orelse ".", fs.path.sep, tmp_dir_sub_path, err,
});
};
}
@@ -3419,13 +3413,13 @@ fn renameTmpIntoCache(
.windows => {
if (seen_eaccess) return error.AccessDenied;
seen_eaccess = true;
- try cache_directory.handle.deleteTree(o_sub_path);
+ try cache_directory.handle.deleteTree(io, o_sub_path);
continue;
},
else => return error.AccessDenied,
},
error.PathAlreadyExists => {
- try cache_directory.handle.deleteTree(o_sub_path);
+ try cache_directory.handle.deleteTree(io, o_sub_path);
continue;
},
error.FileNotFound => {
diff --git a/src/Package/Fetch.zig b/src/Package/Fetch.zig
index aaba0c28cf..3552a7fc06 100644
--- a/src/Package/Fetch.zig
+++ b/src/Package/Fetch.zig
@@ -656,9 +656,11 @@ fn checkBuildFileExistence(f: *Fetch) RunError!void {
/// This function populates `f.manifest` or leaves it `null`.
fn loadManifest(f: *Fetch, pkg_root: Cache.Path) RunError!void {
+ const io = f.job_queue.io;
const eb = &f.error_bundle;
const arena = f.arena.allocator();
const manifest_bytes = pkg_root.root_dir.handle.readFileAllocOptions(
+ io,
try fs.path.join(arena, &.{ pkg_root.sub_path, Manifest.basename }),
arena,
.limited(Manifest.max_bytes),
@@ -1409,7 +1411,7 @@ fn unpackGitPack(f: *Fetch, out_dir: Io.Dir, resource: *Resource.Git) anyerror!U
}
}
- try out_dir.deleteTree(".git");
+ try out_dir.deleteTree(io, ".git");
return res;
}
@@ -1461,7 +1463,7 @@ pub fn renameTmpIntoCache(io: Io, cache_dir: Io.Dir, tmp_dir_sub_path: []const u
cache_dir.rename(tmp_dir_sub_path, cache_dir, dest_dir_sub_path, io) catch |err| switch (err) {
error.FileNotFound => {
if (handled_missing_dir) return err;
- cache_dir.makeDir(dest_dir_sub_path[0..1]) catch |mkd_err| switch (mkd_err) {
+ cache_dir.makeDir(io, dest_dir_sub_path[0..1], .default_dir) catch |mkd_err| switch (mkd_err) {
error.PathAlreadyExists => handled_missing_dir = true,
else => |e| return e,
};
@@ -1469,7 +1471,7 @@ pub fn renameTmpIntoCache(io: Io, cache_dir: Io.Dir, tmp_dir_sub_path: []const u
},
error.PathAlreadyExists, error.AccessDenied => {
// Package has been already downloaded and may already be in use on the system.
- cache_dir.deleteTree(tmp_dir_sub_path) catch {
+ cache_dir.deleteTree(io, tmp_dir_sub_path) catch {
// Garbage files leftover in zig-cache/tmp/ is, as they say
// on Star Trek, "operating within normal parameters".
};
diff --git a/src/Package/Fetch/git.zig b/src/Package/Fetch/git.zig
index 1d6aa1a849..33ff982b66 100644
--- a/src/Package/Fetch/git.zig
+++ b/src/Package/Fetch/git.zig
@@ -253,7 +253,7 @@ pub const Repository = struct {
while (try tree_iter.next()) |entry| {
switch (entry.type) {
.directory => {
- try dir.makeDir(entry.name);
+ try dir.makeDir(io, entry.name, .default_dir);
var subdir = try dir.openDir(io, entry.name, .{});
defer subdir.close(io);
const sub_path = try std.fs.path.join(repository.odb.allocator, &.{ current_path, entry.name });
@@ -296,7 +296,7 @@ pub const Repository = struct {
.gitlink => {
// Consistent with git archive behavior, create the directory but
// do nothing else
- try dir.makeDir(entry.name);
+ try dir.makeDir(io, entry.name, .default_dir);
},
}
}
diff --git a/src/main.zig b/src/main.zig
index 58f0e68301..a832a79dbe 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -7316,6 +7316,7 @@ fn loadManifest(
) !struct { Package.Manifest, Ast } {
const manifest_bytes = while (true) {
break options.dir.readFileAllocOptions(
+ io,
Package.Manifest.basename,
arena,
.limited(Package.Manifest.max_bytes),