diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 05:01:31 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 05:18:09 -0300 |
| commit | 250db41743f77ce3d8421f729bdea0065aa6bc79 (patch) | |
| tree | 906bbefca6d448ba04c81c93cf552e23b5e6c3a4 /src/ninep/pane.zig | |
| parent | 36fe45e3a4a7ce9b61ab7bf2df07f0132a9170c1 (diff) | |
| download | pardes-250db41743f77ce3d8421f729bdea0065aa6bc79.tar.gz pardes-250db41743f77ce3d8421f729bdea0065aa6bc79.zip | |
A name under a directory that may not be searched or written is refused, permission denied, and a Save there says so, not no such directory
`pardes noperm/a/b/c` and `pardes /proc/1/root/x` took the missing
directory for one Save would make, opened a pane and exited 0; its Save
then said "no such directory". fs.deniedAbove finds the nearest
directory there and asks whether it may be searched and written:
forwarding refuses such a name, exit 1, "permission denied", and a
failed Save says "permission denied", which the writer's 9P error
carries as EPERM (9ns: EACCES).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/pane.zig')
| -rw-r--r-- | src/ninep/pane.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index b9fa2857..3963c605 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -1535,13 +1535,15 @@ test "a name with a component over 255 bytes is refused, and a long path's faile try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .name), "/tmp/" ++ "c" ** 255 ++ "\n").reply.status); // A Save of a 3000-byte path the host refuses: the waiting write's // reason is at the end, the path giving up its middle. - const long = "/nonexistent-pardes-root/" ++ ("d" ** 200 ++ "/") ** 15 ++ "f.txt"; + // (Under /tmp: under / a user's Save is refused permission, not + // missing.) + const long = "/tmp/nonexistent-pardes-root/" ++ ("d" ** 200 ++ "/") ** 15 ++ "f.txt"; const id = p.paneBySerial(serial).?; try nameBuffer(p, id, long, false); p.fs.late_failure_len = 0; p.saveFailed(@intCast(id), long, error.AccessDenied); const late = p.fs.late_failure[0..p.fs.late_failure_len]; - try testing.expect(std.mem.startsWith(u8, late, "Save /nonexistent-pardes-root/")); + try testing.expect(std.mem.startsWith(u8, late, "Save /tmp/nonexistent-pardes-root/")); try testing.expect(std.mem.endsWith(u8, late, "/f.txt: no such directory")); } |
