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

Alexey Kardashevskiy aik at ozlabs.ru
Mon Aug 30 23:28:15 AEST 2021

On 30/08/2021 23:10, Segher Boessenkool wrote:
> On Mon, Aug 30, 2021 at 12:53:08PM +0200, Thomas Huth 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.
> How does that work if you feed text with CRLF combos?  If it does accept
> a new line at both CR and LF, that is problematic (it violates both the
> OF and ANS specifications of ACCEPT).

Is it in of1275 somewhere? I looked but did not spot quickly.

> A "real" terminal sends CR only, by default, and can be switched to
> send CRLF instead (by CSI 20h; switch back with CSI 20l).  You cannot do
> only LF on a standard terminal.

"strace cat" shows this on "enter":

read(0, "\n", 131072)   = 1
write(1, "\n", 1)       = 1

What do I miss?

> Can't you just use  nc -C  or similar?

This is an alternative solution, yes :)

> Segher
> _______________________________________________
> SLOF mailing list
> SLOF at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/slof


More information about the SLOF mailing list