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