diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 10:13:09 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 10:36:27 -0300 |
| commit | ecc37bfdc4b5771dfe4bda61b9ffab9ad298950d (patch) | |
| tree | 8acec3b0a727b2ac41963c4739a2a6fd3e7b94e4 /src/builtins.zig | |
| parent | 13c5f281ae0264e42e04bce527b83159fa75466c (diff) | |
| download | pardes-ecc37bfdc4b5771dfe4bda61b9ffab9ad298950d.tar.gz pardes-ecc37bfdc4b5771dfe4bda61b9ffab9ad298950d.zip | |
Mount dials: a relative socket path is a bad dial address, a socket path not there says no such socket (ENOENT), and the hint says tcp! takes a numeric address
`Mount peer rel/x.sock` dialled relative to wherever the editor ran;
`Mount peer unix!/nonexistent` said `dial failed: no answer` (EIO); and
the hint offered `tcp!host!port` where only a numeric address is taken.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index ca80be26..907650bd 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -804,9 +804,20 @@ pub const Mount = struct { if (dial.len == 0) return c.p.reportFailure(c.id, e_args); c.p.fs.mount(c.p.gpa, name, dial) catch |err| { var said: [200]u8 = undefined; - if (err == error.BadDial) return c.p.reportFailure(c.id, std.fmt.bufPrint(&said, "Mount: bad dial address: {s} (unix!/path, tcp!host!port, or a session name)", .{dial[0..@min(dial.len, 100)]}) catch "Mount: bad dial address"); + if (err == error.BadDial) return c.p.reportFailure(c.id, std.fmt.bufPrint(&said, "Mount: bad dial address: {s} (unix!/path, /path, tcp!<numeric-ip>!<port>, or a session name)", .{dial[0..@min(dial.len, 100)]}) catch "Mount: bad dial address"); return c.p.reportError(c.id, "Mount", err); }; + // A socket path that is not there: said so (ENOENT), not a dial + // that went unanswered. + const sock_path: ?[]const u8 = if (std.mem.startsWith(u8, dial, "unix!")) dial[5..] else if (dial.len > 0 and dial[0] == '/') dial else null; + if (sock_path) |path| if (@import("exec.zig").kindOf(path) == null) { + if (c.p.fs.mounts.pop()) |gone| { + c.p.gpa.free(gone.name); + c.p.gpa.free(gone.dial); + } + var said: [200]u8 = undefined; + return c.p.reportFailure(c.id, std.fmt.bufPrint(&said, "Mount {s}: {s}: no such socket", .{ name, path[0..@min(path.len, 100)] }) catch "Mount: no such socket"); + }; // A mount that cannot be reached is said now, and taken back, not // found out by the first look through it. const reached = reached: { |
