[re-adding the list, to publicize your request.  Also, it's nicer to
avoid top-posting on technical lists]

On 01/10/2011 02:14 PM, crocket wrote:
> Can you add an option to round half up/down?
> There are times when users want to see close approximation rather than safely 
> rounded up sizes.

You are welcome to submit such a patch yourself.  Personally, rounding
up doesn't bother me, so I'm unlikely to take the time to write such a
patch myself when I have other more-pressing issues to tackle.

>> However, rounding half down/up is much more common than rounding up in the 
>> real 
>>
>>
>> world.
>> When I expect moderate file size approximation, this 1GB difference is not 
>> ignorable.
>>
>> Is there any reason for this behavior?
> 
> Yes.  -h is a GNU extension, but the comparable -k and -s options have
> behavior specified by POSIX.  And POSIX requires that these options
> round up to the next integral number of units.

Meanwhile, if I'm really concerned about disk usage, I find 'df' to be
much more accurate than 'ls -l'; likewise, if quotas are a concern, I
find quota-specific tools to be more reliable than ls -l.  Sparse files
and hard links both come into play when determining disk usage, and
using 'ls' or 'du' to estimate disk usage is already inherently
inaccurate when compared to actually asking the operating system about
free disk space via 'df'.

-- 
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to