summaryrefslogtreecommitdiff
path: root/core/fs.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-20 03:23:49 -0300
committerGabriel Schneider <[email protected]>2026-11-20 03:57:11 -0300
commit1e127c3968205f0e42faa4eb5b894cea296346d0 (patch)
tree314eac62c4e47f8b20c844dacc957b706a87dc62 /core/fs.zig
parent11f55f018a5eb0699d58627a4f2ea39c2b7f5e89 (diff)
downloadpardes-1e127c3968205f0e42faa4eb5b894cea296346d0.tar.gz
pardes-1e127c3968205f0e42faa4eb5b894cea296346d0.zip
build: pardes-isolate and `zig build run-isolated` are deleted (pardes-build-2 item 1; P31's Q3, decided on the evidence 2026-11-20): the terminal's pardes compiled with `isolated = true`, a build whose host supplied only the terminal (no file, pty, clipboard, LSP or watch calls: tui.zig's second Host table) and whose filesystem was absent (`fs.platform_has_fs` false: every libc path compiled away, the virtual tree and the embedded sources alone), arriving on `src/pardes.zig` read out of the binary when no file was named; it did not compile on the base (`zig build run-isolated -Dplatform=tui -- version`: core/builtins.zig:510 `error.FileNotFound` not in `fs.readFile`'s set, core/ninep/ctl.zig:1298 `error.OutOfMemory` not in `Dir.refresh`'s set) and no test, gate or document ran it; out with it: its module set and step in build.zig, `Core.isolated` and the `isolated` option in build/core.zig, `pardes.isolated` (core/root.zig), `fs.platform_has_fs` and the 60 guards on the two (whole lines in core/Stream.zig, Dir.zig, Plumb.zig, fs.zig, look.zig, Query.zig, edit_cmd.zig, dump.zig, test/fs_namespace.zig, test/terminal.zig; a term of a condition in dev/file_watch.zig's six tests, fs.zig's readFileLimit, whose virtual branch now takes `/virtual/` alone, and one Stream.zig test), Stream.zig's search failing at once without a filesystem, tui.zig's `isolated_vtable`, runtime/main.zig's `src/pardes.zig` default (a file that does not exist), and the mention in docs/next-terminal.md; the changelog says it is gone; build.zig and build/ 2,996 -> 2,981 lines; `pardes version`'s semantics line did not move (`isolated` was never in its text): 8b6382fddba7b382 on tui, gui, the bare build's two, both statics and FreeBSD (gpu/tree2's base binary says the same), 0520895ac88d25ad with -Dtree-sitter=minimal; every shape configures (12) and builds (tui, gui, bare, static musl and gui, FreeBSD, -Dtree-sitter=minimal, the macOS library for Linux and aarch64-macos), -Dtree-sitter=disabled failing as on the base (core/indent.zig:48); tui core-test 856/1006 (150 skipped), shell-test 1046/1049, pane-test 183/184, behaviour-test 275/275 and -- --replay 275/275, term-test 17/17, kitty-test 45/45, addon-test 5/5, lib-test, hxlib 538 cases 0 mismatches, process-test 1 of 144 failed (pagercolor, on the flaky list: passes alone, 931 ms), gui unit-test 1643/1647 (the perf check's BaselineHarnessMismatch, the base's); load 6-17 on 16 cores
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/fs.zig')
-rw-r--r--core/fs.zig15
1 files changed, 3 insertions, 12 deletions
diff --git a/core/fs.zig b/core/fs.zig
index 0797beb0..6e5829e1 100644
--- a/core/fs.zig
+++ b/core/fs.zig
@@ -163,7 +163,6 @@ fn osNode(p: *pardes.Pardes, path: []const u8) !u64 {
/// outlives the yield, and nothing is staged into the shared reply buffer
/// until the turn is back.
pub fn osHandle(p: *pardes.Pardes, req: Req) Reply {
- if (comptime !platform_has_fs) return Reply.fail(req.tag, E.NOENT);
const path = osPath(p, req.node) orelse return Reply.fail(req.tag, E.NOENT);
if (req.op == .release) return .{ .tag = req.tag };
const stat = p.tape.site(.os_stat, null, osStat, .{path}) catch return Reply.fail(req.tag, E.NOENT);
@@ -307,7 +306,6 @@ pub fn statPath(io: std.Io, path: []const u8, options: std.Io.Dir.StatFileOption
/// does: one already there is no failure. A failure shows at the open
/// that follows.
pub fn makeDirs(tape: *pardes.tape.Tape, dir: []const u8) void {
- if (comptime !platform_has_fs) return;
if (dir.len == 0) return;
tape.site(.make_dirs, null, makeDirsHost, .{dir});
}
@@ -320,7 +318,6 @@ fn makeDirsHost(io: std.Io, dir: []const u8) void {
/// nearest ancestor that is there may not be searched or written (EACCES:
/// `noperm/a/b`, `/proc/1/root/x`).
pub fn deniedAbove(dir: []const u8) bool {
- if (comptime !platform_has_fs) return false;
var at: ?[]const u8 = dir;
while (at) |d| : (at = std.Io.Dir.path.dirname(d)) {
var z: [4096]u8 = undefined;
@@ -443,7 +440,6 @@ fn userHome(name: []const u8) ?[]const u8 {
}
pub fn resolveOs(tape: *pardes.tape.Tape, path: []const u8, out: *[4096]u8) ?Resolved {
- if (comptime !platform_has_fs) return null;
var z: [4096]u8 = undefined;
const path_z = std.fmt.bufPrintSentinel(&z, "{s}", .{path}, 0) catch return null;
return tape.site(.resolve, null, resolveHost, .{ path_z, out });
@@ -676,8 +672,6 @@ fn findEmbeddedSource(path: []const u8, allow_root_suffix: bool) ?Source {
return null;
}
-pub const platform_has_fs = !pardes.isolated;
-
fn isDir(path: [*:0]const u8) bool {
const fd = libc.open(path, .{ .ACCMODE = .RDONLY, .DIRECTORY = true, .CLOEXEC = true });
if (fd < 0) return false;
@@ -719,8 +713,8 @@ pub fn restorePath(tape: *pardes.tape.Tape, typed: []const u8, dir_setting: []co
fn readFileLimit(tape: *pardes.tape.Tape, gpa: std.mem.Allocator, path: []const u8, limit: usize) ![]u8 {
if (std.mem.indexOfScalar(u8, path, 0) != null) return error.OpenFailed;
- if (!platform_has_fs or std.mem.startsWith(u8, path, "/virtual/")) {
- const archive_path = if (std.mem.startsWith(u8, path, "/virtual/")) path[9..] else path;
+ if (std.mem.startsWith(u8, path, "/virtual/")) {
+ const archive_path = path[9..];
var normalized_buf: [4096]u8 = undefined;
const normalized = normalizeVirtualPath(archive_path, &normalized_buf) orelse return error.OpenFailed;
const source = findEmbeddedSource(normalized, true) orelse return error.OpenFailed;
@@ -1215,7 +1209,6 @@ test "self files share the regular file limit without preallocating it" {
}
test "bounded reads accept exact OS file lengths and empty files" {
- if (!platform_has_fs) return error.SkipZigTest;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true });
defer p.deinit();
@@ -1327,7 +1320,7 @@ test "bounded reads release terminal snapshots after success and size refusal" {
}
test "bounded reads probe size-unknown proc files at the exact limit" {
- if (!platform_has_fs or @import("builtin").os.tag != .linux) return error.SkipZigTest;
+ if (@import("builtin").os.tag != .linux) return error.SkipZigTest;
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true });
defer p.deinit();
@@ -1379,7 +1372,6 @@ test "self file reads release partial allocations when memory runs out" {
}
test "oversized OS files fail before allocating their contents" {
- if (!platform_has_fs) return error.SkipZigTest;
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
const file = try tmp.dir.createFile(std.testing.io, "oversized", .{});
@@ -1481,7 +1473,6 @@ test "a leading ~ is home, from HOME or else the passwd entry" {
}
test "Restore prefers default directory then falls back to original path" {
- if (!platform_has_fs) return error.SkipZigTest;
const gpa = std.testing.allocator;
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();