[prev in list] [next in list] [prev in thread] [next in thread] 

List:       coreutils-bug
Subject:    bug#60544: sort hangs on lengthy line with invalid UTF8 characters
From:       Pádraig Brady <P () draigBrady ! com>
Date:       2023-01-08 22:03:28
Message-ID: f5db42ee-1b83-b71a-47cc-101a7bb87ea8 () draigBrady ! com
[Download RAW message or body]

tag 60544 notabug
close 60544
stop

On 04/01/2023 04:38, DE CARNE DE CARNAVALET, Xavier [COMP] wrote:
> sort seems to do extra computations on long line with invalid UTF8 characters and \
> could hang for days on just two lines. 
> Here is the minimal example I could make to reproduce the bug:
> $ perl -e 'print "\xcd\xe5\xe0"; print "\n"' > file1
> $ perl -e 'print "\xcd\xe5\xe0"x1000; print "\n"' > file2

> Then:
> $ export LC_ALL=en_US.UTF8
> $ time sort --debug file1 file2
> sort: using 'en_US.UTF8' sorting rules
> [...]
> real    0m1.951s
> user    0m1.951s
> sys     0m0.000s
> 
> It took nearly two seconds to sort two lines from two files.
> If I replace the \xe0 with \x61 in the first (small) file, the time gets down to \
> milliseconds:

If I profile sort like:

   $ src/sort file1 file2 >/dev/null & perf top -p $!

It shows that all the time is spent in libc's __strcoll_l
I see one strcoll performance bug which might be related:
https://sourceware.org/bugzilla/show_bug.cgi?id=18441

I'd follow up with glibc, also specifying your glibc version.

Marking this as not a coreutils bug for now.

cheers,
Pádraig


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic