[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coreutils] [PATCH] sort: -h now handles comparisons such as 6000K v
From: |
Pádraig Brady |
Subject: |
Re: [coreutils] [PATCH] sort: -h now handles comparisons such as 6000K vs 5M and 5MiB vs 5MB |
Date: |
Mon, 09 Aug 2010 01:29:05 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 |
On 03/08/10 03:29, Paul Eggert wrote:
> On 07/30/10 04:06, Pádraig Brady wrote:
>> Perhaps since strtold() is so heavy weight anyway,
>> we could strip commas first?
>
> On further thought I decided that my approach was all wrong, since it
> mishandled "1023K" vs "1M" in output where "K" means 1024 and "M"
> means 1024*1024. So I reverted it and substituted something much like
> the original, except documented to behave the way that it does.
I much prefer this. The previous version was slower while still not being
general.
It also introduced an unlikely edge case ambiguity with 'E' in scientific
notation and when representing "Exa".
So the new version now sorts the following incorrectly,
while not diagnosing it:
99K
97Ki
That's fine I think. ls,df,du etc. don't actually output
"Mi" for powers of 1024, and just append "M" for both
powers of 1000 and 1024. I.E. they produce ambiguous output anyway.
Also the exact position of the unit mismatch was not
pin pointed which wasn't ideal.
Now other tools do output "M" and "Mi" etc. correctly,
and coreutils may be changed to do this in future,
but for now, further complicating the code to support this is
not warranted and I agree with dropping it.
cheers,
Pádraig.