From b43866d6ab784e518df8dbef374147367358ada9 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 30 Sep 2026 14:02:59 -0300 Subject: Save makes the directories its file goes in, always: for the pane's own name and Save path alike Whether a Save made missing directories depended on how the name had come about. Config's pane did, a name written into a missing directory did (since kkrqxtsp), and `Save path` and every other name did not, failing ENOENT instead. There is now one rule: a Save makes the parent directories of the file it writes, a pane's own or a terminal's scrollback included, and the make_dirs flag is gone. A directory it cannot make still fails the write with why, as fs.py's /nonexistent-pardes-dir case shows. fs.py now also saves into missing directories by Save path and by a written name. Co-Authored-By: Claude Opus 5.5 --- test/fs.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/fs.py b/test/fs.py index a1e2ae79..b02b9e45 100644 --- a/test/fs.py +++ b/test/fs.py @@ -381,8 +381,18 @@ def discovery(binary, embedded=False): # Through a mount both read as EINVAL; the log says which and why. assert f'err {scratch} addr: no match for regexp\n'.encode() in client.read('/log') client.remove(f'/pane/{scratch}') - # A save the host cannot do fails the write that asked for it, - # and the log's err record names the path and why. + # A Save makes the directories its file goes in, whatever names + # it: the pane's own name or Save's path. + made_dirs = new_pane(client, b'deep\n') + client.write(f'/pane/{made_dirs}/ctl', f'Save {root}/save-made/a/b/x.txt\n'.encode()) + assert (root / 'save-made/a/b/x.txt').read_bytes() == b'deep\n' + client.write(f'/pane/{made_dirs}/name', f'{root}/save-named/c/y.txt\n'.encode()) + client.write(f'/pane/{made_dirs}/ctl', b'Save\n') + assert (root / 'save-named/c/y.txt').read_bytes() == b'deep\n' + client.remove(f'/pane/{made_dirs}') + # A save the host cannot do (a directory it may not make) fails + # the write that asked for it, and the log's err record names + # the path and why. unsaved = new_pane(client, b'unsaved\n') try: client.write(f'/pane/{unsaved}/ctl', b'Save /nonexistent-pardes-dir/x.txt\n') -- cgit v1.3