diff options
| -rw-r--r-- | src/exec.zig | 5 | ||||
| -rw-r--r-- | test/fs.py | 10 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/exec.zig b/src/exec.zig index 080d0aea..5b170375 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -440,7 +440,10 @@ fn refusedPlacement(p: *Pardes, id: usize) bool { pub fn missingDir(p: *Pardes, dir: []const u8) bool { if (comptime !hosted) return false; if (p.host.vtable.spawn == null) return false; - const local = @import("fs.zig").localPath(dir) orelse return false; + // A peer's directory (`/n/peer/x`) is no directory on this host, where + // the shell would start: no command or terminal runs there, and none + // is made to say `exit 127`. + const local = @import("fs.zig").localPath(dir) orelse return std.mem.startsWith(u8, dir, "/n/"); return !isDirectory(local); } @@ -467,6 +467,16 @@ def run_file(binary): with tempfile.TemporaryDirectory() as directory: root = Path(directory) with session(binary, root, 'run') as (client, address): + # From a pane on a peer's path no command or terminal starts: + # refused before any pane is made, no `exit 127` pane left. + peer = new_pane(client, b'') + client.write(f'/pane/{peer}/name', b'/n/nosuchpeer/d/f.txt\n') + count = len(client.read('/index').splitlines()) + execute_refused(client, peer, 'ls', 'no such directory') + execute_refused(client, peer, 'Tty', 'no such directory') + assert len(client.read('/index').splitlines()) == count, client.read('/index') + assert b'exit 127' not in client.read('/log') + client.remove(f'/pane/{peer}') client.write('/exec', b'Shell bash\n') client.write('/exec', b'Tty\n') term = int(max(r.split()[0] for r in client.read('/index').splitlines() if r.split()[1] == b'term')) |
