summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/builtins_json.zig4
-rw-r--r--src/config.zig5
-rw-r--r--src/fs.zig3
-rw-r--r--src/ninep/ctl.zig15
4 files changed, 19 insertions, 8 deletions
diff --git a/src/builtins_json.zig b/src/builtins_json.zig
index 4440130d..3598a3e2 100644
--- a/src/builtins_json.zig
+++ b/src/builtins_json.zig
@@ -66,7 +66,9 @@ pub fn write(w: *std.Io.Writer) !void {
}
test "docs/typ/builtins-<platform>.json is what the registry says now" {
- // a terminal build checks its file, a window build its own
+ // a terminal build checks its file, a window build its own; both are
+ // Linux builds' lists (Tty9p is Linux's)
+ if (comptime @import("builtin").os.tag != .linux) return error.SkipZigTest;
const file = switch (pardes.platform) {
.tty => "builtins-tty.json",
.gui => "builtins-gui.json",
diff --git a/src/config.zig b/src/config.zig
index 66b11c72..f0023193 100644
--- a/src/config.zig
+++ b/src/config.zig
@@ -2277,7 +2277,10 @@ const doc_typ = struct {
for (std.enums.values(Builtin)) |b| if (leader_path.get(b)) |p|
if (std.mem.eql(u8, p, path[0..n])) return true;
for (leader_args) |la| if (std.mem.eql(u8, la.path, path[0..n])) return true;
- return false;
+ // A word this build leaves out (Tty9p off Linux) keeps its leader in the other's.
+ var buf: [96]u8 = undefined;
+ const needle = std.fmt.bufPrint(&buf, "\"leader\": \"{s}\"", .{k}) catch return false;
+ return std.mem.indexOf(u8, other_build, needle) != null;
}
toks.reset();
while (toks.next()) |t| if (!bound(chord(t) orelse return false)) return false;
diff --git a/src/fs.zig b/src/fs.zig
index 08379697..9104c93f 100644
--- a/src/fs.zig
+++ b/src/fs.zig
@@ -708,7 +708,8 @@ pub fn deniedAbove(dir: []const u8) bool {
}
test "a directory under one that may not be searched or written is denied, one merely missing is not" {
- try std.testing.expect(deniedAbove("/proc/1/root/x/y"));
+ // The refusing directory is Linux's /proc/1/root.
+ if (comptime @import("builtin").os.tag == .linux) try std.testing.expect(deniedAbove("/proc/1/root/x/y"));
try std.testing.expect(!deniedAbove("/tmp/pardes-surely-missing-dir/a/b"));
}
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 9cb96667..3176ebc8 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -4676,8 +4676,8 @@ test "pager answers its +Pager on the open that asked, whatever another client e
try testing.expectEqualStrings("/tmp/+Pager", second_pane.file.?.path);
try testing.expect(p.paneBySerial(paged) != null);
_ = call(p, .{ .tag = 14, .op = .release, .node = pager, .handle = resolved, .opened = true });
- // One that may not be written is refused, permission denied.
- try testing.expectEqual(E.PERM, wr(p, pager, "/proc/1\n").errno());
+ // One that may not be written is refused, permission denied (Linux's /proc/1).
+ if (comptime @import("builtin").os.tag == .linux) try testing.expectEqual(E.PERM, wr(p, pager, "/proc/1\n").errno());
// One directory a write, absolute, and there.
try testing.expectEqual(E.INVAL, wr(p, pager, "/a\n/b\n").errno());
// One directory an open: one refused is not followed by another, as a
@@ -4786,8 +4786,11 @@ test "a command pane an exec open was answered is leased to it while it stays op
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"));
+ // The refusing directory is Linux's /proc/1/root.
+ if (comptime @import("builtin").os.tag == .linux) {
+ 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"));
}
@@ -5036,8 +5039,10 @@ test "DumpDir refuses a relative directory and one that may not be written, up f
defer p.deinit();
const root_ctl = @backingInt(tree.TopFile.ctl);
try testing.expectEqual(E.INVAL, wr(p, root_ctl, "DumpDir dumps\n").errno());
- try testing.expectEqual(E.INVAL, wr(p, root_ctl, "DumpDir /proc/1/root/dumps\n").errno());
try testing.expectEqual(Status.ok, wr(p, root_ctl, "DumpDir /tmp/pardes-dumps-test\n").reply.status);
+ // The refusing directory is Linux's /proc/1/root.
+ if (comptime @import("builtin").os.tag != .linux) return;
+ try testing.expectEqual(E.INVAL, wr(p, root_ctl, "DumpDir /proc/1/root/dumps\n").errno());
p.fs.late_failure_len = 0;
p.dumpFailed("/proc/1/root/x/pardes.dump.zon", error.FileNotFound);
try testing.expect(std.mem.endsWith(u8, p.fs.late_failure[0..p.fs.late_failure_len], ": permission denied"));