summaryrefslogtreecommitdiff
path: root/src/host_io.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 13:36:33 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commitfea3f2c5abf14aada5d9187b82985e51eb5b7a98 (patch)
tree6dd3c54c8aaa1ad5941a74200b18da12e512b7fb /src/host_io.zig
parentbe5f559939fc11cbfba95b4a7d518816bec8677a (diff)
downloadpardes-fea3f2c5abf14aada5d9187b82985e51eb5b7a98.tar.gz
pardes-fea3f2c5abf14aada5d9187b82985e51eb5b7a98.zip
A path with a part over 255 bytes is refused, never a panic
std's statFile takes the kernel's ENAMETOOLONG for a bug (errnoBug), so a name, look, DumpDir or Save path with a part over 255 bytes panicked the editor (exec.kindOf via writeName, recentKeeps, dumpFailed). Every non-test statFile now goes through fs.statPath, which refuses such a name as NameTooLong first; fs.py drives long, looping, not-a-directory and not-ours paths through name, look, DumpDir, Dump and Save. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/host_io.zig')
-rw-r--r--src/host_io.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/host_io.zig b/src/host_io.zig
index 8bbb0985..9d4b27c2 100644
--- a/src/host_io.zig
+++ b/src/host_io.zig
@@ -1048,7 +1048,7 @@ pub const Shell = struct {
var buf: [2048]u8 = undefined;
try std.testing.expectEqualStrings(bash_rc, readSmall(a_bash, &buf) orelse return error.ReadFailed);
try std.testing.expectEqualStrings(fish_rc, readSmall(a.fishPath().?, &buf) orelse return error.ReadFailed);
- const stat = try std.Io.Dir.cwd().statFile(std.testing.io, a_bash, .{});
+ const stat = try @import("fs.zig").statPath(std.testing.io, a_bash, .{});
try std.testing.expectEqual(0, stat.permissions.toMode() & 0o077);
var kept: [rc_path_capacity:0]u8 = @splat(0);
@memcpy(kept[0..a_bash.len], a_bash);
@@ -1202,7 +1202,7 @@ pub fn forkShell(
// A shell's directory may be inside a mount this editor serves.
pardes.turn.yield();
defer pardes.turn.back();
- const stat = try std.Io.Dir.cwd().statFile(std.Io.Threaded.global_single_threaded.io(), path, .{});
+ const stat = try @import("fs.zig").statPath(std.Io.Threaded.global_single_threaded.io(), path, .{});
if (stat.kind != .directory) return error.NotDir;
break :dir path;
};
@@ -1440,7 +1440,7 @@ pub fn shellCwd(pid: libc.pid_t, buf: []u8) ?[]const u8 {
// no directory to be named by, so the name it had stays, and a
// restart works there once it is back.
if (std.mem.endsWith(u8, link, " (deleted)")) {
- _ = std.Io.Dir.cwd().statFile(std.Io.Threaded.global_single_threaded.io(), link, .{}) catch return null;
+ _ = @import("fs.zig").statPath(std.Io.Threaded.global_single_threaded.io(), link, .{}) catch return null;
}
return link;
},