summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/ctl.zig9
-rw-r--r--src/ninep/pane.zig6
2 files changed, 13 insertions, 2 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index c88eb328..d6d7a6ee 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -4056,3 +4056,12 @@ test "a command pane an exec open was answered is leased to it while it stays op
try testing.expectEqual(Status.ok, wr(p, exec, "echo c\n").reply.status);
try testing.expectEqual(a_pane, p.paneBySerial(p.fs.results[0]).?);
}
+
+test "a Save whose directory is missing because one above refuses says permission denied, not no such directory" {
+ const p = try withFile(testing.allocator, "x\n");
+ defer p.deinit();
+ p.saveFailed(0, "/proc/1/root/x/f.txt", error.FileNotFound);
+ try testing.expect(th.logHas(p, "Save /proc/1/root/x/f.txt: permission denied"));
+ p.saveFailed(0, "/tmp/pardes-surely-missing-dir/f.txt", error.FileNotFound);
+ try testing.expect(th.logHas(p, "no such directory"));
+}
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"));
}