Re: [PATCH] Revert "kernel/printk: add kmsg SEEK_CUR handling"

From: Jason A. Donenfeld
Date: Sat Jul 11 2020 - 19:19:59 EST


On Sun, Jun 21, 2020 at 9:02 PM Jason A. Donenfeld <Jason@xxxxxxxxx> wrote:
> This commit broke userspace. Bash uses ESPIPE to determine whether or
> not the file should be read using "unbuffered I/O", which means reading
> 1 byte at a time instead of 128 bytes at a time. I used to use bash to
> read through kmsg in a really quite nasty way:
>
> while read -t 0.1 -r line 2>/dev/null || [[ $? -ne 142 ]]; do
> echo "SARU $line"
> done < /dev/kmsg
>
> This will show all lines that can fit into the 128 byte buffer, and skip
> lines that don't. That's pretty awful, but at least it worked.

FYI, bash finally bumped its read buffer up to 4k, which actually
makes reading /dev/kmsg less awful than previously thought:
http://git.savannah.gnu.org/cgit/bash.git/commit/?id=6edcd70089d71ee8c17bf3298527054b3223be9f
This is probably too mundane to warrant an email, but in case somebody
finds this thread in the future, voila.