From ecc37bfdc4b5771dfe4bda61b9ffab9ad298950d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 10:13:09 -0300 Subject: 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 --- src/builtins.zig | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/builtins.zig') 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!!, 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: { -- cgit v1.3