emacs-bug-tracker
[Top][All Lists]
Advanced

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

bug#55212: closed (GNU Linux "sort -g" can hang indefinitely when run on


From: GNU bug Tracking System
Subject: bug#55212: closed (GNU Linux "sort -g" can hang indefinitely when run on standard input if NaNs are involved)
Date: Mon, 02 May 2022 06:04:01 +0000

Your message dated Sun, 1 May 2022 23:03:38 -0700
with message-id <b3568035-5a1d-253b-c738-e26c38d8ada0@cs.ucla.edu>
and subject line Re: bug#55212: GNU Linux "sort -g" can hang indefinitely when 
run on standard input if NaNs are involved
has caused the debbugs.gnu.org bug report #55212,
regarding GNU Linux "sort -g" can hang indefinitely when run on standard input 
if NaNs are involved
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
55212: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=55212
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: GNU Linux "sort -g" can hang indefinitely when run on standard input if NaNs are involved Date: Sun, 1 May 2022 13:16:10 -0400
As explained here, when running "sort -g" from standard input, if NaNs are involved, this can cause "sort -g" to hang indefinitely while consuming 100% of the CPU. This seems to be system dependent. I cannot reproduce the bug on a RHEL7 machine. However, multiple users seem to be able to reproduce the bug. The following command can provoke the bug:
yes nan | head -n128095 | timeout 5 sort -g

--- End Message ---
--- Begin Message --- Subject: Re: bug#55212: GNU Linux "sort -g" can hang indefinitely when run on standard input if NaNs are involved Date: Sun, 1 May 2022 23:03:38 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Thanks for the bug report. This bug is entertaining, as it comes from GCC now being so smart that it optimizes away a memset that cleared padding bits. We added the memset in coreutils 8.14 (2011) to try to fix the sort -g infinite loop bug (introduced in 1999), but the memset isn't guaranteed to fix the bug because the memset can be optimized away.

If the padding bits happen to be clear already sort is OK, but if not the results can be inconsistent when you compare two NaNs to each other, and inconsistent results can make sort infloop.

The C standard allows this level of intelligence in the compiler, so it's a bug in GNU 'sort'.

I installed the attached patch; please give it a try. For now I'll boldly close the bug report; we can easily reopen it if this patch doesn't actually fix the problem.

Attachment: 0001-sort-fix-sort-g-infloop-again.patch
Description: Text Data


--- End Message ---

reply via email to

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