From unknown Sat Aug 09 15:57:31 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#28152 <28152@debbugs.gnu.org> To: bug#28152 <28152@debbugs.gnu.org> Subject: Status: Human readable units (-h/--human-readable vs --si) - Wrong prefix and missing unit Reply-To: bug#28152 <28152@debbugs.gnu.org> Date: Sat, 09 Aug 2025 22:57:31 +0000 retitle 28152 Human readable units (-h/--human-readable vs --si) - Wrong pr= efix and missing unit reassign 28152 coreutils submitter 28152 Michael Weiss severity 28152 wishlist tag 28152 wontfix thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 16:24:39 2017 Received: (at submit) by debbugs.gnu.org; 19 Aug 2017 20:24:40 +0000 Received: from localhost ([127.0.0.1]:45859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djAIR-0002Xo-DU for submit@debbugs.gnu.org; Sat, 19 Aug 2017 16:24:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38486) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dj9Ow-0001Ej-6n for submit@debbugs.gnu.org; Sat, 19 Aug 2017 15:27:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dj9Op-0005Zz-K4 for submit@debbugs.gnu.org; Sat, 19 Aug 2017 15:27:12 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:49929) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dj9Op-0005Ze-GL for submit@debbugs.gnu.org; Sat, 19 Aug 2017 15:27:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dj9Oo-0008GL-3c for bug-coreutils@gnu.org; Sat, 19 Aug 2017 15:27:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dj9Ok-0005VA-S5 for bug-coreutils@gnu.org; Sat, 19 Aug 2017 15:27:10 -0400 Received: from mail-wr0-x234.google.com ([2a00:1450:400c:c0c::234]:34829) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dj9Ok-0005RN-Lx for bug-coreutils@gnu.org; Sat, 19 Aug 2017 15:27:06 -0400 Received: by mail-wr0-x234.google.com with SMTP id 49so70359243wrw.2 for ; Sat, 19 Aug 2017 12:27:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=1/UL8QPFirRDw0rWTSn19myN6xGkmNSWDG+WLl2nUqk=; b=j/2OH8mr374Pqq329imPVopLHBOJM63e5W8DHaz0jLxaqxER+qtlWarMAVnHxSua0P JWjyeynA6OP6S6VJYVq3yq8aBDjCZubzxlo8A5VZnVFOb6kXDbBVaUN7y0Bm/3wlX3eg Rg5scm1YyiqSWaauKoGFmOStqpNuewslij1XBhbgq7DB+0i5IdaQ3sDNPElU2lc8nUY0 rg7TJoU3D99JQpc2V53Whfy3Hc4j5ge2h0oo39hUShDhtoigIqho1tszMBUv24us8GHm +FVkZF5VBH7lSV+/n218DP2nS0eWIImzjr1X77NcV/xin5dj59mlw6luF6qBhwkQBzg1 bjzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=1/UL8QPFirRDw0rWTSn19myN6xGkmNSWDG+WLl2nUqk=; b=N0sUcf2pbtBAZZha7uWAP3LJlgTs9Z/Cdff8B4x8S1Vonlwo8bCCAAzm71cF52NaA0 o86awEP8opZwXU6AIQMPaQuiJWIiUoApgZ7w8UXHX+SuDsLtNXOual6yb4YPg7HhlRfV 4N6xEsIRH8b/PDxdbsOnJ1pImQdQMhPTT6RUkw5G0v0roRKJz79Kk54EfKwjARo+XiWo n0/96fXi2Z1VtUDz8I03sP5QDOrlYIy828kn0ZsIDHyxIzFxVGaoYvAjcajCV1ovkiGA TFLqAE5LNT1MKAsBdpLDgeQaQTcUXNTFtJL7wjYcHxJb0Ick/feO8FLSYHHgcNcvLlI+ 0t1g== X-Gm-Message-State: AHYfb5i/xcVoIfsgLISD/ff5H7ndBxfkIcs9kc25ScEvvd/4gajDRA9i DFoJiyQSASu5wLmy X-Received: by 10.223.141.212 with SMTP id o78mr7409962wrb.215.1503170824026; Sat, 19 Aug 2017 12:27:04 -0700 (PDT) Received: from jarvis.primeos.eu (HSI-KBW-078-043-000-080.hsi4.kabel-badenwuerttemberg.de. [78.43.0.80]) by smtp.gmail.com with ESMTPSA id d17sm9975756wrc.78.2017.08.19.12.27.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 19 Aug 2017 12:27:03 -0700 (PDT) Date: Sat, 19 Aug 2017 21:27:02 +0200 From: Michael Weiss To: bug-coreutils@gnu.org Subject: Human readable units (-h/--human-readable vs --si) - Wrong prefix and missing unit Message-ID: <20170819192702.tkecnw7kkonkonxo@jarvis.primeos.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline User-Agent: Mutt X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 19 Aug 2017 16:24:37 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Imho the units used in the output of df, du, ls, etc. with the -h/--human-readable option can be very misleading/ambiguous and in the case of -h/--human-readable even wrong according to standards. I don't want to flame about this but I'd love it if we could discuss this objectively by considering the official standards and change the output appropriately. First of all I hope we can agree that the current output is ambiguous and therefore not really useful unless the exact command that generated that output is known (or at least if --si or -h was used). Imho this is not desirable and already causes some problems when sharing that output without providing the command. If we look at the standards Wikipedia [0] provides the following table (I've removed the JEDEC units as they shouldn't be relevant here ("Unit prefixes for semiconductor storage capacity")): Prefixes for multiples of bits (bit) or bytes (B) Decimal | Binary Value SI | Value IEC 1000 k kilo | 1024 Ki kibi 10002 M mega | 10242 Mi mebi 10003 G giga | 10243 Gi gibi 10004 T tera | 10244 Ti tebi 10005 P peta | 10245 Pi pebi 10006 E exa | 10246 Ei exbi 10007 Z zetta | 10247 Zi zebi 10008 Y yotta | 10248 Yi yobi These are the unit prefixes that I'm used to and they have the advantage that they're unambiguous and standardized. "With the aim of avoiding ambiguity the International Electrotechnical Commission (IEC) adopted new binary prefixes in 1998 (IEC 80000-13:2008 formerly subclauses 3.8 and 3.9 of IEC 60027-2:2005) Each binary prefix is formed from the first syllable of the decimal prefix with the similar value, and the syllable "bi". The symbols are the decimal symbol, always capitalised, followed by the letter "i". According to these standards, kilo, mega, giga et seq. would only be used in the decimal sense, even when referring to data storage capacities: kilobyte and megabyte would denote one thousand and one million bytes respectively (consistent with the metric system), while new terms such as kibibyte, mebibyte and gibibyte, with symbols KiB, MiB and GiB, would denote 210, 220 and 230 bytes respectively." [1] And last but not least we should provide the actual unit as well. In this case all units are in bytes which we can abbreviate with B (not with a lowercase b as that would mean bits). This should make the output completely unambiguous, follow the standards and avoid the possibility of misinterpretation. I can understand that changing such historic things might always cause some minor problems but delaying them doesn't make them magically go away. And since this change would only affect the human readable output it shouldn't really break any scripts. An example: Old: 114M fileA 120M fileA New: 114MiB fileA 120MB fileA Or alternatively: 114 MiB fileA 120 MB fileA Links/References: - https://en.wikipedia.org/wiki/Unit_prefix#Binary_prefixes - https://en.wikipedia.org/wiki/Data_rate_units - http://man7.org/linux/man-pages/man7/units.7.html - http://man7.org/linux/man-pages/man1/numfmt.1.html - https://debbugs.gnu.org/cgi/bugreport.cgi?bug=7176 - https://debbugs.gnu.org/cgi/bugreport.cgi?bug=18119 GNU coreutils version: 8.27 OS: GNU/Linux Kind regards, Michael [0]: https://en.wikipedia.org/wiki/Unit_prefix [1]: https://en.wikipedia.org/wiki/Unit_prefix#Binary_prefixes From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 19 17:09:11 2017 Received: (at 28152) by debbugs.gnu.org; 19 Aug 2017 21:09:11 +0000 Received: from localhost ([127.0.0.1]:45870 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djAzW-0003fB-SH for submit@debbugs.gnu.org; Sat, 19 Aug 2017 17:09:11 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:42654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djAzU-0003ew-2S for 28152@debbugs.gnu.org; Sat, 19 Aug 2017 17:09:08 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 2EF89160898; Sat, 19 Aug 2017 14:09:02 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id JAdQF8rZao-B; Sat, 19 Aug 2017 14:09:01 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 1C65016088E; Sat, 19 Aug 2017 14:09:01 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id H6B7AmWayQ1I; Sat, 19 Aug 2017 14:09:01 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.153.184.153]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id E2D16160881; Sat, 19 Aug 2017 14:09:00 -0700 (PDT) Subject: Re: bug#28152: Human readable units (-h/--human-readable vs --si) - Wrong prefix and missing unit To: Michael Weiss References: <20170819192702.tkecnw7kkonkonxo@jarvis.primeos.eu> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <68c93a2b-248d-61cd-e4c1-36e9453d3ed2@cs.ucla.edu> Date: Sat, 19 Aug 2017 14:09:00 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170819192702.tkecnw7kkonkonxo@jarvis.primeos.eu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 28152 Cc: 28152@debbugs.gnu.org, =?UTF-8?Q?Mihai_Capot=c4=83?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Michael Weiss wrote: > I can understand that changing such historic things might always cause > some minor problems I'm afraid the problems would be more than minor, as other programs parse= the=20 output (there's an option in GNU 'sort' to do that, for example). That be= ing=20 said, I could be talked into a patch like the one that Mihai Capot=C4=83 = suggested in: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D7176#11 as this would be upward-compatible. It would need documentation though. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 21 19:20:42 2017 Received: (at 28152) by debbugs.gnu.org; 21 Aug 2017 23:20:42 +0000 Received: from localhost ([127.0.0.1]:48320 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djvzu-0005r3-BV for submit@debbugs.gnu.org; Mon, 21 Aug 2017 19:20:42 -0400 Received: from mail-wr0-f174.google.com ([209.85.128.174]:33810) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djvcH-0005Hd-TR for 28152@debbugs.gnu.org; Mon, 21 Aug 2017 18:56:18 -0400 Received: by mail-wr0-f174.google.com with SMTP id p14so42052609wrg.1 for <28152@debbugs.gnu.org>; Mon, 21 Aug 2017 15:56:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=nYJbRPXo3W6bX4vLket4vspe8zzwqtcU8BT0vvqOqRM=; b=XUNttjeLJXktqYq/pCq2jAOLymHN8O0GqVgaLV7fc/3dyODBioLJx0OU5pvsxizjpH +Rhx3HRHmlvmTpx6qpBTXvvng4QQRF9HzYRN2PG/nreAfKSiCWdVLJxs0VSVMduU4Fe2 B+OtlpNBxC/+ey5uICNOnuGAhUZYvxnLYaN+Cip54Mp5Qgd4M8tuvrSEyy9gLMRB/Sz+ ypRI+bb1OKvz7B4F2O2i2El0BFx6PBH7e0KrKH8GITuIwxRlJZB6dOCrKMhAc56S5CJB +/rUQ/BLVy0nd7RNPZ31jFQfLN96ZHLI9qvKa9GgIZMiSi7ZdQIqFuaOX5WHOc+HeTqT AqdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=nYJbRPXo3W6bX4vLket4vspe8zzwqtcU8BT0vvqOqRM=; b=G/Y9yEH20juczKh/Wzu7CAKHXJj9Y0OXN5z6t7zjzjxYmIX5pEki2UU+NFHYT2wtSa araRsDVm0iz2GpA/24hEh+aDXDKSW959F98FD1FL8H79m9YpO86DGEETkHg7qgej7F2K JuE9sZEhlyTkO0IrMcx/d8N3UL77YulQZ4z9+PHLZv17oDGexCe3q8eYLFuOxbQyEc3z 9ptvv+PgmmTarVqzvc/Xt2ZUqUOVLLWC+UKIhcOSTjlrYk+AVyoGaNQEH8tRWTioVDKW jrFSRfEOlu9UhpG/8dO0G3gZFRY14DIqXnwus7+wo0k9NVb3MiigiS1IOI++BBGRAgwH 7nAg== X-Gm-Message-State: AHYfb5hSTig/gr7SBslwMlYn6UHjrUNpG0YJlhvM52crEWUrfJDrjSDW GNb/jGPBWUSvig== X-Received: by 10.223.180.66 with SMTP id v2mr10857974wrd.210.1503356171877; Mon, 21 Aug 2017 15:56:11 -0700 (PDT) Received: from jarvis.primeos.eu (HSI-KBW-078-043-000-080.hsi4.kabel-badenwuerttemberg.de. [78.43.0.80]) by smtp.gmail.com with ESMTPSA id n17sm10973211wra.6.2017.08.21.15.56.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Aug 2017 15:56:11 -0700 (PDT) Date: Tue, 22 Aug 2017 00:56:09 +0200 From: Michael Weiss To: Paul Eggert Subject: Re: bug#28152: Human readable units (-h/--human-readable vs --si) - Wrong prefix and missing unit Message-ID: <20170821225609.jrnc5bf4fbqhnpbe@jarvis.primeos.eu> References: <20170819192702.tkecnw7kkonkonxo@jarvis.primeos.eu> <68c93a2b-248d-61cd-e4c1-36e9453d3ed2@cs.ucla.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <68c93a2b-248d-61cd-e4c1-36e9453d3ed2@cs.ucla.edu> User-Agent: Mutt X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 28152 X-Mailman-Approved-At: Mon, 21 Aug 2017 19:20:41 -0400 Cc: 28152@debbugs.gnu.org, Mihai =?utf-8?Q?Capot=C4=83?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) On Sat, 19 Aug, 2017 at 14:09:00 -0700, Paul Eggert wrote: > I'm afraid the problems would be more than minor, as other programs parse > the output (there's an option in GNU 'sort' to do that, for example). You're right, I was way too optimistic about this. But still, it could be way worse imho. > That being said, I could be talked into a patch like the one that > Mihai Capotă suggested in: > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=7176#11 > > as this would be upward-compatible. It would need documentation though. Imho that patch would already be a great improvement but probably still not enough. If I didn't miss anything it would overwrite the default behaviour i.e. if one would want to get the normal output one would have to execute something like this: "env -u BLOCK_SIZE ls -l". The other problem would be that the behaviour of -h and --si wouldn't change at all. If one would like to change the default unit/format of the output (e.g. via .bashrc) this would be great but unfortunately it wouldn't cover the use case where one would like to use all binaries normally but get the "human_B" output. Do you think it would be possible to add another variable that wouldn't overwrite the default but use the "human_B" output with -h or --si? In that case one could set something like "HUMAN_B=true" and get the following output: $ du -s 116244 . $ du -sh 114MiB . $ du -s --si 120MB . PS: Thanks for your fast reply (and sorry for my delay...). From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 21 19:21:43 2017 Received: (at 28152) by debbugs.gnu.org; 21 Aug 2017 23:21:43 +0000 Received: from localhost ([127.0.0.1]:48324 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djw0s-0005t0-UB for submit@debbugs.gnu.org; Mon, 21 Aug 2017 19:21:43 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:40178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djw0r-0005sm-9s for 28152@debbugs.gnu.org; Mon, 21 Aug 2017 19:21:41 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 8CDFF16088C; Mon, 21 Aug 2017 16:21:35 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id rr6-LUgCQIqf; Mon, 21 Aug 2017 16:21:34 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E1AC5160892; Mon, 21 Aug 2017 16:21:34 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id LgwaWboC3ysx; Mon, 21 Aug 2017 16:21:34 -0700 (PDT) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 889D816088B; Mon, 21 Aug 2017 16:21:34 -0700 (PDT) Subject: Re: bug#28152: Human readable units (-h/--human-readable vs --si) - Wrong prefix and missing unit To: Michael Weiss References: <20170819192702.tkecnw7kkonkonxo@jarvis.primeos.eu> <68c93a2b-248d-61cd-e4c1-36e9453d3ed2@cs.ucla.edu> <20170821225609.jrnc5bf4fbqhnpbe@jarvis.primeos.eu> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Mon, 21 Aug 2017 16:21:27 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170821225609.jrnc5bf4fbqhnpbe@jarvis.primeos.eu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 28152 Cc: 28152@debbugs.gnu.org, =?UTF-8?Q?Mihai_Capot=c4=83?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) On 08/21/2017 03:56 PM, Michael Weiss wrote: > Do you think it would be possible to add another variable that wouldn't > overwrite the default but use the "human_B" output with -h or --si? Probably not. We've been heading more in the opposite direction, in that we'd rather not have environment variables affect the behavior of standard utilities, due to the possibility of confusion and even attacks on unwary users. For interactive use you can define your own du command or alias that behaves the way you prefer. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 21 19:58:33 2017 Received: (at 28152) by debbugs.gnu.org; 21 Aug 2017 23:58:33 +0000 Received: from localhost ([127.0.0.1]:48341 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djwaW-0006hf-TH for submit@debbugs.gnu.org; Mon, 21 Aug 2017 19:58:33 -0400 Received: from mail-it0-f53.google.com ([209.85.214.53]:37696) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1djwaV-0006hS-3U for 28152@debbugs.gnu.org; Mon, 21 Aug 2017 19:58:32 -0400 Received: by mail-it0-f53.google.com with SMTP id 76so39201951ith.0 for <28152@debbugs.gnu.org>; Mon, 21 Aug 2017 16:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=/Qjbat60vYXxG95k6hyEakT96WzfPdv2INMwyphD1Cg=; b=tnBV0M0BBK/GNsdqmO8npsfqdF5CWtxU4OqyAXCVJ7GVp5acM5YWdQLpbAz/7QXwYK mcwdGPMxh7JOvPWzPF8lX/8POTjeW15kBtz4967u/zcVTct43oHFXArWPsHvRtZl9gho 5QZJpln1MBJgTh4gB8Cea0G6dV1HhLqjI0byTwyyYo4q5cB23p423Dl/20e1Eb9tuoEY 59M+ohCFZPHFgZmcnZd6zg5t5hkPpSuXtnRc+gW+5CXI6rFhhGIEkoJZzuvkazTbTsrU rdJcWPwEVPwcZyO6tdP2aUcCiIcu18/NlcKdZ8yg8wPuhkj6H5rc6qB97jXWbwNrWzUu L+/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/Qjbat60vYXxG95k6hyEakT96WzfPdv2INMwyphD1Cg=; b=rb0IhbPh+OSgh4/nHK7xfdxu3b1t/tNIBvLSm7vPdI3ZChpHnO5QYhp/Ivl6k3YFYB bYUfuOlknPNFv1gUZ3FvzCn3kiGe+kW2hSfiexpFAVIGUE8hptYJD+pfexwQvidNVTvM yqlRaADJ/Blsmp3lCjX8cj195pxUE7uGb89S6jz34wZ/jw9xgfZfoUKnzDZfu4y4XhxH pCBx6b8Gtqudt8cKw54HlXxt6urQlcNreXIm7oo8wvaCbemtmCPMz3ND7fb9xUzJ5HHm O1U29rryvTHBJ/IJbJ/gcCHfqUnOPBY3K2OD8INRbhVtPczmh9O0L5beNJ/UJEJPyZ4v o0og== X-Gm-Message-State: AHYfb5ioiDAFOOaIhFg3IGSRsjosUKEg2RPEfe+457kkCjVuwrU2qXrg AoYPEBYh2pVIlEpLZjQ= X-Received: by 10.36.188.129 with SMTP id n123mr1719772ite.162.1503359905115; Mon, 21 Aug 2017 16:58:25 -0700 (PDT) Received: from [192.168.88.239] ([184.68.105.38]) by smtp.gmail.com with ESMTPSA id e68sm2262350itc.41.2017.08.21.16.58.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Aug 2017 16:58:24 -0700 (PDT) Subject: Re: bug#28152: Human readable units (-h/--human-readable vs --si) - Wrong prefix and missing unit To: Michael Weiss , 28152@debbugs.gnu.org References: <20170819192702.tkecnw7kkonkonxo@jarvis.primeos.eu> From: Assaf Gordon Message-ID: <936d1652-9f28-aa95-f034-b559ad97cbc2@gmail.com> Date: Mon, 21 Aug 2017 17:58:29 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170819192702.tkecnw7kkonkonxo@jarvis.primeos.eu> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -0.2 (/) X-Debbugs-Envelope-To: 28152 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.2 (/) Hello Michael, On 19/08/17 01:27 PM, Michael Weiss wrote: > Imho the units used in the output of df, du, ls, etc. with the > -h/--human-readable option can be very misleading/ambiguous and in the > case of -h/--human-readable even wrong according to standards. [...] > Old: > 114M fileA > 120M fileA > New: > 114MiB fileA > 120MB fileA [...] > - http://man7.org/linux/man-pages/man1/numfmt.1.html You've mentioned numfmt(1), it's worth noting that your request is exactly what numfmt was designed to do. The following commands will display df/du/ls output in SI and IEC-I units, giving the output you wanted: ls -l | numfmt --suffix B --field=5 --to=si ls -l | numfmt --suffix B --field=5 --to=iec-i du | numfmt --format "%-10f" --suffix B --field 1 --to=si du | numfmt --format "%-10f" --suffix B --field 1 --to=iec-i df | numfmt --suffix B --header --field=2-4 --to=si df | numfmt --suffix B --header --field=2-4 --to=iec-i And these can be rather easily put into a shell function so it'll be easy to use: df_si() { df "$@" | numfmt --suffix B --header --field=2-4 --to=si ; } Note that numfmt with multiple fields requires coreutils 8.24 or later (but since you're using 8.27 it should not be a problem). Hope this helps, - assaf From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 29 21:09:04 2018 Received: (at 28152) by debbugs.gnu.org; 30 Oct 2018 01:09:04 +0000 Received: from localhost ([127.0.0.1]:52377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHIWm-0008B2-Aj for submit@debbugs.gnu.org; Mon, 29 Oct 2018 21:09:04 -0400 Received: from mail-pf1-f171.google.com ([209.85.210.171]:42120) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHIWl-0008AU-6F; Mon, 29 Oct 2018 21:09:03 -0400 Received: by mail-pf1-f171.google.com with SMTP id f26-v6so4905007pfn.9; Mon, 29 Oct 2018 18:09:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=L/r7UM1DjIz/Usqb1x75Clmc73qbVkhTdENxj1rYzSk=; b=itBbakXUbL58fCDTfp+svEXSeyRHHoqy+nKLcK/Jd8nGV1mrhi9yDySc9zSeMDIX6W WvxHPd7DYvlerIOh75nnvsFJ0MQh3njZC6NdIKOvdrnpFPHiMWxh5nH0EmkXAN3gBDN4 a1mXNxk0UVxtSkn4ETSE7IlUPZET/i3HKJPvfe474yBLZaYeuYsDQOCVJ11CbeMoUaZG /74opofhgMeitR0Z2M+G++PSm7jKkhwDvXEyFZi+jgHpdf7RIcft3tWQxtGBKwYTmWeJ Gp/al97/5VqAJ2ttrZmrJVBPCrT8tNVYr5Ikm7/ldF3Mb7de30U+lMD7eLBk2KiZ7cKf 7ZYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=L/r7UM1DjIz/Usqb1x75Clmc73qbVkhTdENxj1rYzSk=; b=jh9VcWe8bbqlJMI0C6cjXM0Kh+lfkp+/lu4oZiz4iD1IHTomCQG+WXL6B3N+ocHZut jOuBSZ3mHiqpiUivwbZp2UVXTzmBRtHny4t4OkPkno2pIcx5yaq8LSgiJ+nEWpCC8Rvs GsVDSVQNnweY9KqKYkf9gW0ApP8lmP4u1Kn1KnLQ2CR05KFmNbsG3cO1OegFy7phj+Ib 3lGmnTZiwcnOU2kV5iHk4t0NewfflDbow1cEvoDFWANnJANovV/AE9Jvddjo7xIS0h8O 6D1WLBTZjS03W0rRa9TSZFoD/Rzk8Q0M3zTVbwAjRWN/FmMWggzlFCW7/b32h6wwXyn8 QVYA== X-Gm-Message-State: AGRZ1gKz52Wgg4Xh0HjtPmsWjCHkDw0qs/QVa7K5+XSrjYHMbEK4YMG7 5Y2lXMx/oY1k+SDgC7GRn0dq9EWP034= X-Google-Smtp-Source: AJdET5fssAPRqRJP6jdzo4zkBvB44ZH21WlmpsdyWIA56EaL2IQz+VnZXZttWwhteAQG76//4U1IUg== X-Received: by 2002:a63:6150:: with SMTP id v77mr15579664pgb.266.1540861736520; Mon, 29 Oct 2018 18:08:56 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id p11-v6sm24094080pfo.65.2018.10.29.18.08.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 18:08:55 -0700 (PDT) Subject: Re: bug#28152: Human readable units (-h/--human-readable vs --si) - Wrong prefix and missing unit To: 28152@debbugs.gnu.org References: <20170819192702.tkecnw7kkonkonxo@jarvis.primeos.eu> <68c93a2b-248d-61cd-e4c1-36e9453d3ed2@cs.ucla.edu> <20170821225609.jrnc5bf4fbqhnpbe@jarvis.primeos.eu> From: Assaf Gordon Message-ID: Date: Mon, 29 Oct 2018 19:08:53 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 28152 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) severity 28152 wishlist tags 28152 wontfix close 28152 stop (triaging old bugs) On 2017-08-21 5:21 p.m., Paul Eggert wrote: > On 08/21/2017 03:56 PM, Michael Weiss wrote: >> Do you think it would be possible to add another variable that wouldn't >> overwrite the default but use the "human_B" output with -h or --si? > > Probably not. We've been heading more in the opposite direction, in that > we'd rather not have environment variables affect the behavior of > standard utilities, due to the possibility of confusion and even attacks > on unwary users. For interactive use you can define your own du command > or alias that behaves the way you prefer. On 2017-08-21 5:58 p.m., Assaf Gordon wrote: > You've mentioned numfmt(1), it's worth noting that your request is > exactly what numfmt was designed to do. With no further comments, I'm closing this bug. Discussion can continue by replying to this thread. -assaf From unknown Sat Aug 09 15:57:31 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 27 Nov 2018 12:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator