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

Previous Next

Package: coreutils;

Reported by: L A Walsh <coreutils <at> tlinx.org>

Date: Fri, 12 Mar 2021 04:54:02 UTC

Severity: normal

Tags: notabug

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 47085 in the body.
You can then email your comments to 47085 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#47085; Package coreutils. (Fri, 12 Mar 2021 04:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to L A Walsh <coreutils <at> tlinx.org>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 12 Mar 2021 04:54:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: L A Walsh <coreutils <at> tlinx.org>
To: Coreutils <bug-coreutils <at> gnu.org>
Subject: du: why does 'usage' show prefixes 'Z' or 'Y' if they are disallowed?
Date: Thu, 11 Mar 2021 20:53:03 -0800
I thought to display 0 (or 0<magnitude>) 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).







Information forwarded to bug-coreutils <at> gnu.org:
bug#47085; Package coreutils. (Fri, 12 Mar 2021 07:53:01 GMT) Full text and rfc822 format available.

Message #8 received at 47085 <at> debbugs.gnu.org (full text, mbox):

From: Erik Auerswald <auerswal <at> unix-ag.uni-kl.de>
To: L A Walsh <coreutils <at> tlinx.org>
Cc: 47085 <at> debbugs.gnu.org
Subject: Re: bug#47085: du: why does 'usage' show prefixes 'Z' or 'Y' if they
 are disallowed?
Date: Fri, 12 Mar 2021 08:52:22 +0100
Hi,

On Thu, Mar 11, 2021 at 08:53:03PM -0800, L A Walsh wrote:
> I thought to display 0 (or 0<magnitude>) 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




Information forwarded to bug-coreutils <at> gnu.org:
bug#47085; Package coreutils. (Fri, 12 Mar 2021 10:05:02 GMT) Full text and rfc822 format available.

Message #11 received at 47085 <at> debbugs.gnu.org (full text, mbox):

From: "Glenn Golden" <gdg <at> zplane.com>
To: 47085 <at> debbugs.gnu.org
Subject: Re: bug#47085: du: why does 'usage' show prefixes 'Z' or 'Y' if they are disallowed?
Date: Fri, 12 Mar 2021 03:03:10 -0700
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.




Information forwarded to bug-coreutils <at> gnu.org:
bug#47085; Package coreutils. (Fri, 12 Mar 2021 19:48:02 GMT) Full text and rfc822 format available.

Message #14 received at 47085 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: L A Walsh <coreutils <at> tlinx.org>
Cc: 47085 <at> debbugs.gnu.org
Subject: Re: bug#47085: du: why does 'usage' show prefixes 'Z' or 'Y' if they
 are disallowed?
Date: Fri, 12 Mar 2021 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.




Information forwarded to bug-coreutils <at> gnu.org:
bug#47085; Package coreutils. (Fri, 12 Mar 2021 20:23:02 GMT) Full text and rfc822 format available.

Message #17 received at 47085 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Golden <gdg <at> zplane.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 47085 <at> debbugs.gnu.org, L A Walsh <coreutils <at> tlinx.org>
Subject: Re: bug#47085: du: why does 'usage' show prefixes 'Z' or 'Y' if they
 are disallowed?
Date: Fri, 12 Mar 2021 13:22:26 -0700
Paul Eggert <eggert <at> cs.ucla.edu> [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."






Added tag(s) notabug. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Mon, 21 Feb 2022 10:08:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 47085 <at> debbugs.gnu.org and L A Walsh <coreutils <at> tlinx.org> Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Mon, 21 Feb 2022 10:08:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 21 Mar 2022 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 30 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.