From 261eb7ac3f090c8ce47ad47c0f58f824a9b162a6 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 11:43:08 -0300 Subject: A Dump into a DumpDir that is no directory says so; the doc says a missing last directory is made DumpDir /dev/null said no such directory though it is there, and the doc claimed a missing DumpDir always fails, where its last component is made at the Dump. Co-Authored-By: Claude Opus 5.5 --- src/pardes.zig | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/pardes.zig') diff --git a/src/pardes.zig b/src/pardes.zig index 2bf594c4..f6032ac5 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -5425,11 +5425,15 @@ pub const Pardes = struct { pub fn dumpFailed(p: *Pardes, path: []const u8, err: anyerror) void { var what: [limits.host_path_cap + 8]u8 = undefined; const operation = std.fmt.bufPrint(&what, "Dump {s}", .{path}) catch "Dump"; - // Into a DumpDir that is not there: said so, ENOENT, as a Save is. + // Into a DumpDir that is not there: said so, ENOENT, as a Save is; + // one that is there but no directory (`/dev/null`) says that. const parent = std.fs.path.dirname(path) orelse "/"; - const no_dir = err == error.FileNotFound or err == error.NotDir or - (if (comptime hosted) (if (filesystem.localPath(parent)) |local| !exec.isDirectory(local) else false) else false); - if (no_dir) { + const kind: ?std.Io.File.Kind = if (comptime hosted) (if (filesystem.localPath(parent)) |local| exec.kindOf(local) else .directory) else .directory; + const no_dir = err == error.FileNotFound or err == error.NotDir or kind != .directory; + if (kind != null and kind != .directory) { + var said: [limits.host_path_cap + 48]u8 = undefined; + p.reportFailure(p.active, std.fmt.bufPrint(&said, "{s}: {s} is not a directory", .{ operation, parent }) catch "Dump: not a directory"); + } else if (no_dir) { var said: [limits.host_path_cap + 48]u8 = undefined; p.reportFailure(p.active, std.fmt.bufPrint(&said, "{s}: no such directory", .{operation}) catch "Dump: no such directory"); } else p.reportError(p.active, operation, err); -- cgit v1.3