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

Greg Kurz groug at kaod.org
Mon Aug 30 22:53:03 AEST 2021


On Mon, 30 Aug 2021 12:53:08 +0200
Thomas Huth <thuth at redhat.com> wrote:

> 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?
> 

FWIW I don't remember, but I see no reason not to allow LF as well.

Reviewed-by: Greg Kurz <groug at kaod.org>

and

Tested-by: Greg Kurz <groug at kaod.org>

>  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
>     BEGIN
>        key dup 0d <>
> +      over 0a <> and
>     WHILE
>        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