GNU bug report logs - #47023
df utilility displays G instead of GM as unit size for Gigabytes in power of 1000

Previous Next

Package: coreutils;

Reported by: Philippe Bénézech <philippe.benezech <at> laposte.net>

Date: Tue, 9 Mar 2021 16:07:02 UTC

Severity: wishlist

Tags: wontfix

Merged with 18119

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: Philippe Bénézech <philippe.benezech <at> laposte.net>, 47023 <at> debbugs.gnu.org
Subject: bug#47023: df utilility displays G instead of GM as unit size for Gigabytes in power of 1000
Date: Tue, 9 Mar 2021 19:51:45 +0000
unarchive 18119
forcemerge 18119 47023
stop


On 09/03/2021 12:58, Philippe Bénézech via GNU coreutils Bug Reports wrote:
> Dear maintener,
> 
> I found a reproducible bug in df utility, installed in debian stable
> 
> $ df --version |head -1
> df (GNU coreutils) 8.30
> $ cat /etc/debian_version
> 10.8
> 
> df displays G instead of GM as unit size for Gigabytes in power of 1000
> (but the value is correct)

This is not restricted to G

> $ df -BGB /home
> Sys. de fichiers blocs de 1GB Utilisé Disponible Uti% Monté sur
> /dev/mapper/ssd2        421GB   355GB       45GB  89% /home
> 
> $ df -H /home
> Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
> /dev/mapper/ssd2   421G    355G   45G  89% /home

In summary df -H is outputting with a concise single letter,
which is indistinguishable from that of df -h.
I agree that's not ideal as the output can't be
interpreted without the command as context.
I.e. it restricts usage to direct command line usage.
A possible change we could make here would be to use GB, MB etc.
if --si is specified.
But also -h and -H are not really useful outside of direct cli usage,
I'm 50:50 on changing this.

This was originally discussed at https://bugs.gnu.org/18119

Mentioned there is an option to use the new numfmt functionality
to provide more control and unambiguous output.

BTW the fact that a B suffix implies SI units is awkward in the first place,
which I've documented the reasons for at:
https://www.pixelbeat.org/docs/coreutils-gotchas.html#units

cheers,
Pádraig




This bug report was last modified 4 years and 155 days ago.

Previous Next


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