К сожалению, разработчики bc 1.07 допустили досадную ошибку, которая при определённых обстоятельствах зацикливает bc бесконечно. И эти обстоятельства возникают при сборке ядра Linux:
* package version(s): bc 1.07-1
Steps to reproduce:
create a file "foobar.bc" with this line as content: foobar = read();
run "echo 1 | bc -q foobar.bc"
bc will spin at 100% CPU load. A strace log ends with
read(0, "1\n", 4096) = 2
read(0, "", 4096) = 0
read(0, "", 4096) = 0
read(0, "", 4096) = 0
where it reads the 1 just like it should, but then it spins on reading empty strings forever.
With bc 1.06 the same bc script works without issues.
I don't know if this is an upstream bug or something with readline/edline/whatever specifically in Archlinux.
This also breaks building the kernel, because make prepare runs echo 300 | bc -q kernel/time/timeconst.bc which
then spins forever on read().
Quick fix:
execute.c:
in function "int input_char (void)"
Change the lines:
if (in_ch <= ' ')
return (' ');
To:
if (in_ch <= ' ')
return (':');
I'll be doing a 1.07.1 release shortly that has a few other tweaks,
but this fix will stop the read() bug.