[SLOF] [PATCH] slof/fs/accept: Allow Unix LF line endings, too

Thomas Huth thuth at redhat.com
Mon Aug 30 20:53:08 AEST 2021

Currently SLOF only accepts CR (0x0d) line endings at the command prompt,
since this is the default line ending used on serial consoles. However,
sometimes people try to connect to SLOF directly in a way that uses the
typical Unix LF line endings (0x0a) which are then completely ignored,
for example running QEMU like this:

 qemu-system-ppc64 -nodefaults \
    -chardev socket,path=/tmp/mysocket,wait=off,id=cs0,server=on \
    -device spapr-vty,id=serial0,reg=0x30000000,chardev=cs0

and then connect to that Unix socket via "nc -U /tmp/mysocket".

For such use cases, allow the 0x0a line ending in SLOF, too.

Signed-off-by: Thomas Huth <thuth at redhat.com>
 I'm not quite sure anymore ... didn't we already run into this problem
 a couple of times in the past already? Was there a reason that we never
 allowed 0x0a here, too?

 slof/fs/accept.fs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/slof/fs/accept.fs b/slof/fs/accept.fs
index cb6f2fa..26e9216 100644
--- a/slof/fs/accept.fs
+++ b/slof/fs/accept.fs
@@ -392,6 +392,7 @@ TABLE-EXECUTE handle-control
    1b emit 37 emit
       key dup 0d <>
+      over 0a <> and
       dup 9 <> IF 0 to ?tab-pressed THEN \ reset state machine
       dup 7f = IF drop 8 THEN \ Handle DEL as if it was BS. ??? bogus

More information about the SLOF mailing list