From abd040180e210e74448c42f094aab1769ca6c636 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 30 Jul 2010 01:52:59 -0600 Subject: sort: -h now handles comparisons such as 6000K vs 5M and 5MiB vs 5MB * NEWS: Document changes to sort -h. * doc/coreutils.texi (sort invocation): Likewise. * src/sort.c (long_double, strtold): Move to prelude, since they're now used by multiple functions. (LD): New macro. (struct keyfield.iec_present): Remove this member. All uses removed. (check_mixed_SI_IEC): Remove. This code was busted in the presence of multiple threads, as it had a race condition. (find_unit_order): Remove arg KEY; add arg THOU_SEP; arg ENDPTR is now char ** rather than char const **. Return an integer that distinguishes decimal from binary powers. Parse the number consistently with the intersection of strtold and strnumcmp. Set *ENDPTR unconditionally. (compute_human): New static function. (human_numcompare): Remove arg KEY. Remove 'const' from other args. Use strnumcmp if possible, but fall back on floating point if not. (numcompare, general_numcompare): Arg EA is now char ** rather than char const **. (numcompare): Adjust to new find_unit_order signature and behavior. (keycompare): Adjus to new human_numcompare signature. * tests/misc/sort (h1, h3, h4, h6): Adjust to new behavior. * tests/misc/sort-debug-keys: Likewise. --- NEWS | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'NEWS') diff --git a/NEWS b/NEWS index b19294b38..4e2cb3de1 100644 --- a/NEWS +++ b/NEWS @@ -39,6 +39,16 @@ GNU coreutils NEWS -*- outline -*- sort -g now uses long doubles for greater range and precision. + sort -h no longer mishandles comparisons such as 5MiB vs 5MB, or + 6000K vs 5M. It uses floating-point arithmetic for these cases, + though, which means that the comparisons are not exact. This is not + a problem when sorting the output of df, du, and ls because this + output contains so few digits before suffixes. + + sort -h no longer rejects numbers ending in trailing "." or having + leading ".". It no longer accepts numbers with multiple "." or + numbers with thousands separators. + sort now uses the number of available processors to parallelize the sorting operation. The number of sorts run concurrently can be limited with the --parallel option or with external process -- cgit v1.2.3-54-g00ecf