bug-coreutils
[Top][All Lists]
Advanced

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

bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug)


From: Pádraig Brady
Subject: bug#51011: [GNU sort] Numerical sort with delimiter may be broken (bug)
Date: Sat, 9 Oct 2021 03:32:08 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0

On 08/10/2021 21:48, Paul Eggert wrote:
On 10/8/21 6:37 AM, Pádraig Brady wrote:

The difference here is due to ',' being treated as a thousands sep,
not a decimal point.

Oh, thanks. Of course! I should have figured that out myself.

It is unfortunate that "," is treated as a thousands seperator even
though it's obviously not one (as it's not followed by 3 decimal
digits). I don't think POSIX requires this behavior; it's not clear to
me that POSIX even allows it.

Well in general it's not a thousands separator, rather a grouping character,
and groups can be in 2, 3, 4, and even 5.  So I don't think we should
change the logic here.

This bug report suggests that we should alter the code so that 'sort -n'
acts more like common practice, and requires thousands separators to be
in the right places in order to treat nearby digits to be part of the
number. Alternatively, we could document the existing behavior (even if
it's not clear that it conforms to POSIX).

What we can do is have --debug warn when there is an overlap
in --field-separator and the grouping and decimal characters
when using numeric keys.  I'll have a look at that tomorrow.

cheers,
Pádraig





reply via email to

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