From 78d6f64e72be2a22c40feaf012636bc8f04d46de Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 09:03:41 -0300 Subject: A shell given a directory is not taken to be in this process's before it has spoken, so it logs no rename to the session's and back Each host read /proc//cwd right after forking the shell and at every frame after; before the shell's chdir that says this process's directory, a rename to it, then the real one a frame later, a rename back. A shell given a directory is named by it already (newShell) and is no longer asked at fork; and until it has printed anything, an answer naming this process's directory is not taken. Co-Authored-By: Claude Opus 5.5 --- test/fs.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test') diff --git a/test/fs.py b/test/fs.py index 89801a71..d2cd631c 100644 --- a/test/fs.py +++ b/test/fs.py @@ -494,6 +494,26 @@ def unattended_messages_expire(binary): assert not shown(), 'an unattended message outlived MessageLinger' +def new_terminals_named_once(binary): + """A terminal started outside the session's directory is named by that + directory from its `new` on: no rename to the session's and back.""" + with tempfile.TemporaryDirectory(prefix='pardes-names-') as directory: + root = Path(directory) + (root / 'sub').mkdir() + with session(binary, root, 'names') as (client, _): + made = [look(client, str(root / 'sub'))] + before = {int(row.split()[0]) for row in client.read('/index').splitlines()} + client.write('/pane/1/ctl', b'Tty\n') + if shutil.which('fish'): + client.write('/pane/1/ctl', b'Tty fish\n') + made += [s for s in (int(row.split()[0]) for row in client.read('/index').splitlines()) if s not in before] + time.sleep(1.5) # their shells start and say where they are + log = client.read('/log').decode() + for serial in made: + assert f'\nrename {serial} ' not in '\n' + log, (serial, log) + assert f'\nnew {serial} {root}' in '\n' + log, (serial, log) + + def python_repl_runs_one_line(binary): """A one-line exec sent to Python's own REPL (3.13's pyrepl, which asks for bracketed paste) runs at once, with no second Enter: the Enter @@ -610,6 +630,7 @@ def test(binary, quic=False): run_file(binary) exit_answers(binary) unattended_messages_expire(binary) + new_terminals_named_once(binary) python_repl_runs_one_line(binary) signal_cleans_up(binary) for options, message in [ -- cgit v1.3