From f453e3c3014ec578bbe6601a141134ce034185ff Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 01:03:41 -0300 Subject: An event record is delivered in pieces to reads shorter than it, so a bash read loop on event works A read shorter than the record waiting was refused EINVAL, and bash's read, a byte at a time on a file it cannot seek in, failed on the first record. A short read now takes the record's front and the next read the rest, as log and pty/data already did and acme allows. A unit test reads two records a byte at a time; selfmount runs a bash read on event through the mount. Co-Authored-By: Claude Opus 5.5 --- test/selfmount.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/selfmount.py b/test/selfmount.py index dd59083c..503ce1e0 100644 --- a/test/selfmount.py +++ b/test/selfmount.py @@ -186,6 +186,16 @@ def run(binary): followed = recipe.read_text() if recipe.exists() else '' recipe.unlink(missing_ok=True) check(ran == '0' and 'recipe-heard' in followed, f'the log follow recipe with cat hears a new record ({followed[-120:]!r})') + # A bash read loop on a pane's event: bash reads it a piece at a + # time, and each record still arrives whole, in pieces. + looped = Path(f'/tmp/{name}.events') + ran = run((f"bash -c 'exec 3<{mount}/pane/{first}/event; " + f"(sleep 1; echo Msg ev-loop > {mount}/pane/{first}/exec) & " + f"read -r line <&3; echo \"$line\" > {looped}'\n").encode()) + got_line = looped.read_text() if looped.exists() else '' + looped.unlink(missing_ok=True) + check(ran == '0' and got_line.startswith('FX') and got_line.rstrip().endswith('Msg ev-loop'), + f'a bash read loop on event reads a whole record ({got_line!r})') client.write('/exec', b'Msg still here\n') text = ''.join(cell[0] for cell in client.screen()['cells']) check('still here' in text, 'the editor answers after all of that') -- cgit v1.3