summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fs.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/fs.py b/test/fs.py
index 75d03d40..a025ec47 100644
--- a/test/fs.py
+++ b/test/fs.py
@@ -814,6 +814,30 @@ def signal_cleans_up(binary):
assert not address.exists() and not detached.exists(), (sig, list(root.iterdir()))
+def odd_paths(binary):
+ """Long and odd paths written where a path goes -- name, look, DumpDir,
+ Dump, Save -- are refused or said, never a crash: a part over 255 bytes
+ (ENAMETOOLONG), a loop of links (ELOOP), a file taken for a directory
+ (ENOTDIR), one not ours (EACCES)."""
+ with tempfile.TemporaryDirectory(prefix='pardes-odd-') as directory:
+ root = Path(directory)
+ (root / 'loop').symlink_to(root / 'loop')
+ (root / 'plain').write_bytes(b'x\n')
+ odd = ['/tmp/' + 'x' * 300 + '/f.txt', str(root / ('y' * 300)), str(root / 'loop' / 'f'),
+ str(root / 'plain' / 'f'), '/root/nope/f', str(root / 'a' / '..' / 'b.txt')]
+ with session(binary, root, 'odd') as (client, _):
+ serial = new_pane(client, b'text\n')
+ for path in odd:
+ for where, line in ((f'/pane/{serial}/name', path), ('/look', path),
+ ('/ctl', f'DumpDir {path}'), ('/ctl', 'Dump'), (f'/pane/{serial}/ctl', 'Save')):
+ try:
+ client.write(where, (line + '\n').encode())
+ except OSError:
+ pass
+ assert client.read('/index'), (where, line)
+ client.write('/ctl', b'DumpDir\n')
+
+
def cut_writes(binary):
"""A write bigger than a 9P message comes as several, cut anywhere: each
command line runs once, whole, an Edit block once it ends, and a last
@@ -846,6 +870,7 @@ def cut_writes(binary):
def test(binary, quic=False):
started = time.monotonic()
cut_writes(binary)
+ odd_paths(binary)
run_file(binary)
exit_answers(binary)
unattended_messages_expire(binary)