bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#55225: GNU Linux "sort -g" can hang indefinitely when run on standar


From: Ole Tange
Subject: bug#55225: GNU Linux "sort -g" can hang indefinitely when run on standard input (on Ubuntu)
Date: Mon, 2 May 2022 10:59:48 +0000

https://unix.stackexchange.com/a/700967/2972

    dd if=/dev/urandom count=800000 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=80000000 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]