https://unix.stackexchange.com/a/700967/2972
dd if=/dev/urandom count=80 bs=1 | od -An -t f4 -w4 | sponge | sort -g
goes into infinite loop.
It is caused by 'nan' showing up at a position that apparently is bad.
This works (100x bigger than the example above but removes all nan's):
dd if=/dev/urandom count=8000 bs=1 | od -An -t f4 -w4 | sponge | grep
-v nan | time sort -g |tail
The bug can be provoked with:
yes nan | head -n128095 | timeout 5 sort -g
The crazy part is, that this works:
yes nan | head -n128095 > nan
timeout 5 sort -g < nan
timeout 5 sort -g nan
So it looks like something that is only relevant when reading from a pipe.
I can reproduce this on Ubuntu 20.04 and Ubuntu 22.04, but I cannot reproduce
the error on CygWin.
Regards
Ole Tange