bug#47085: du: why does 'usage' show prefixes 'Z' or 'Y' if they are disallowed?

2021-03-12 Thread Glenn Golden
Paul Eggert  [2021-03-12 11:46:52 -0800]:
> On 3/11/21 8:53 PM, L A Walsh wrote:
> > Why are those suffixes listed as valid under the program 'usage'
> > and manpage, when they are automatically disallowed?
> 
> They are valid if your computer has wide-enough integers. As far as I know
> no platform supports Y and only one or two supports Z, but the documentation
> is future-proofing.
> 
> Conversely, if you're running on a really small computer that doesn't even
> support 64-bit integers, even 'T' is too wide.
> 
> I doubt whether it's worth complicating the manual for this minor detail, as
> the current diagnostic "'Y" too large" is accurate as far as it goes.
> 

The manual actually does address this briefly:

coreutils.info 8.32, Section 2.3:

   "Large sizes like ‘1Y’ may be rejected by your computer due to
limitations of its arithmetic."







bug#47085: du: why does 'usage' show prefixes 'Z' or 'Y' if they are disallowed?

2021-03-12 Thread Paul Eggert

On 3/11/21 8:53 PM, L A Walsh wrote:

Why are those suffixes listed as valid under the program 'usage'
and manpage, when they are automatically disallowed?


They are valid if your computer has wide-enough integers. As far as I 
know no platform supports Y and only one or two supports Z, but the 
documentation is future-proofing.


Conversely, if you're running on a really small computer that doesn't 
even support 64-bit integers, even 'T' is too wide.


I doubt whether it's worth complicating the manual for this minor 
detail, as the current diagnostic "'Y" too large" is accurate as far as 
it goes.






bug#47085: du: why does 'usage' show prefixes 'Z' or 'Y' if they are disallowed?

2021-03-12 Thread Glenn Golden
On Thu, Mar 11, 2021, at 21:53, L A Walsh wrote:
>
> Also something I didn't see as being clear:
>   I don't see where it says it will always round up to next higher
>   unit (it may say it somewhere, I just don't see it and was
>   surprised to see 'du -BT /tmp|hsort -s' show all objects as
>   being 1.0T and for hsort to show a summary of ~148T
>   (hsort sorts by human prefixes and has an optional '-s'
>   switch that shows an additive sum of the sizes).
> 

See coreutils.info Section 14.2 (entitled "du: Estimate file space  usage",
second paragraph), and coreutils.info Section 2.3  (entitled "Block size",
first paragraph).  Both state that fractional block sizes are rounded up
to the nearest integer.





bug#47085: du: why does 'usage' show prefixes 'Z' or 'Y' if they are disallowed?

2021-03-11 Thread Erik Auerswald
Hi,

On Thu, Mar 11, 2021 at 08:53:03PM -0800, L A Walsh wrote:
> I thought to display 0 (or 0) for 1st arg by doing:
> 
> du -BY, as -B says I can list a unit for scaling, but for
> -BY and -BZ I get:
> du: -B argument 'Y' too large.
> 
> It doesn't even look to see how much space is used, it
> immediately returns Y & Z are "too large".

Speculation (i.e., I did not look at the code): Z means 2^70, Y means
2^80, so they are both too big for unsigned 64bit integers.  Thus they
may be too big for du?

> Why are those suffixes listed as valid under the program 'usage'
> and manpage, when they are automatically disallowed?

Perhaps they are automatically used with sufficiently sized integer types,
i.e., this may be future proofing?

You could look at the code to get a deeper insight.

HTH,
Erik
-- 
Be water, my friend.
-- Bruce Lee





bug#47085: du: why does 'usage' show prefixes 'Z' or 'Y' if they are disallowed?

2021-03-11 Thread L A Walsh

I thought to display 0 (or 0) for 1st arg by doing:

du -BY, as -B says I can list a unit for scaling, but for
-BY and -BZ I get:
du: -B argument 'Y' too large.

It doesn't even look to see how much space is used, it
immediately returns Y & Z are "too large".

Why are those suffixes listed as valid under the program 'usage'
and manpage, when they are automatically disallowed?

Also something I didn't see as being clear:
 I don't see where it says it will always round up to next higher
 unit (it may say it somewhere, I just don't see it and was
 surprised to see 'du -BT /tmp|hsort -s' show all objects as
 being 1.0T and for hsort to show a summary of ~148T
 (hsort sorts by human prefixes and has an optional '-s'
 switch that shows an additive sum of the sizes).