GNU bug report logs - #17553
du unit suggestion

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Reported by: Reuben Thomas <rrt@HIDDEN>; Keywords: notabug; Done: Paul Eggert <eggert@HIDDEN>; Maintainer for coreutils is bug-coreutils@HIDDEN.

Message received at 17553 <at> debbugs.gnu.org:


Received: (at 17553) by debbugs.gnu.org; 28 Apr 2024 18:10:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 28 14:10:28 2024
Received: from localhost ([127.0.0.1]:51536 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1s18yn-0002N1-47
	for submit <at> debbugs.gnu.org; Sun, 28 Apr 2024 14:10:28 -0400
Received: from mail-yw1-x1130.google.com ([2607:f8b0:4864:20::1130]:51483)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rrt@HIDDEN>) id 1s18yd-0002Mn-9n
 for 17553 <at> debbugs.gnu.org; Sun, 28 Apr 2024 14:10:23 -0400
Received: by mail-yw1-x1130.google.com with SMTP id
 00721157ae682-61587aa9f4cso42466027b3.3
 for <17553 <at> debbugs.gnu.org>; Sun, 28 Apr 2024 11:09:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sc3d.org; s=google; t=1714327790; x=1714932590; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=YqVEfqrNN0Ei/PbrKQnzP3P1O8mfP0tnI7egqw3LbzQ=;
 b=2dWUaCndSyKQnXxeymcnYOBvhTm0qmbbfMGy03yN3eb45UD+4u13iop6/+cBpjIdWx
 CQkI1qzNdkqNCxum8JdJqJxfqrHky8zyEDh7rkd/3ObCBHPvpBjTA0ry6lZpnHImbXqT
 I9ZY3VZ+n6HOlmuX9HNUZyDA8HrxpxXoKW/qQ=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1714327790; x=1714932590;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=YqVEfqrNN0Ei/PbrKQnzP3P1O8mfP0tnI7egqw3LbzQ=;
 b=PN5I0JnuJhwmBF/J85ZAgMgr/WHBjVrQM0wHJIETdy2wEznvAVcXfS2q9Re6l9zAlf
 2nv5r+9Xbj9OOHDQJlJ0EMXLqgK9IyD6VFWGARG+V8echYKYYLBzN76OvMerYwBhtbCH
 N4SgY2CS8K5MYrlEgJ4vPj0IiC+TFVCpemJUytrme3ggW8yTY/FhHJlhBTxSuNyZasTl
 JKBKI3NNEQdei1RZuBsNxaYWENWh1jJMsOfZCaBauVqq6b68Wst8dm05Dwo5hJPNMlmZ
 krA0rWDjEJcLe1LQKLVDUwL23OjfF373gro67v2l7/y5X9zTRxCZuTQctm3/O7VpQYSh
 1epw==
X-Gm-Message-State: AOJu0YwWqLLX/EQquEdzPvuIpkL+wrTyG8Ss7124+1WtSc9gHzbd1R1C
 gClkUEj/38DPEZq5uEZ0cPnQH1jBJPDSV619jSc6Jfg2v86rZZmAs8JnBnKlhzVHKGKr7xjFLTh
 qG2OJ1DQIBqsodFEOeU3Iu0lSejE460Y4AYF8EpVoDt4SBKMNZlQ=
X-Google-Smtp-Source: AGHT+IFDjwwt8cjZZyLeZJ2melIDmUhQtTJggecqshlr84WBY2ii3ii1yco+Sk8sjvRXpeDguxs07yeQEYVehGH6OMQ=
X-Received: by 2002:a05:690c:7087:b0:61b:33fc:ad8f with SMTP id
 jg7-20020a05690c708700b0061b33fcad8fmr8911059ywb.45.1714327790045; Sun, 28
 Apr 2024 11:09:50 -0700 (PDT)
MIME-Version: 1.0
References: <CAOnWdoiz9q7J5BnvTJnKZURc=MAc-Lauh1246KXfN_kK7cOAZw@HIDDEN>
 <537E80FF.2040603@HIDDEN>
 <CAOnWdogi5Dz=ohyz_Cj4pF9K0211p0h-5QJO+zWPHoCESY3XJA@HIDDEN>
 <537F3B2D.9090600@HIDDEN>
 <CAOnWdojF0_BGRdu2CwwKQxdeOdB=ObK2WQmDvb7MWK1d=kbd5w@HIDDEN>
 <CAOnWdog-YW5n9ne1ZROrWzirZ+skyOyhavjuNd+yF2oMsd3hQw@HIDDEN>
In-Reply-To: <CAOnWdog-YW5n9ne1ZROrWzirZ+skyOyhavjuNd+yF2oMsd3hQw@HIDDEN>
From: Reuben Thomas <rrt@HIDDEN>
Date: Sun, 28 Apr 2024 20:09:38 +0200
Message-ID: <CAOnWdohMJLizRY2kqCa1B-68zU=Quoq_nvf9xXMMk849QB=hMQ@HIDDEN>
Subject: Re: bug#17553: du unit suggestion
To: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000f4695106172c0a5f"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 17553
Cc: 17553 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000f4695106172c0a5f
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Fri, 23 May 2014 at 15:02, Reuben Thomas <rrt@HIDDEN> wrote:

> On 23 May 2014 13:12, P=C3=A1draig Brady <P@HIDDEN> wrote:
>
>> tl;dr
>>
>>   You can get what you want currently by doing:
>>
>>     du() { env du -B1 "$@" | numfmt --to=3Diec-i --suffix=3DB; }
>>
>
> Thanks very much, that's certainly good enough for me.
>

Today I found that this doesn't cope with filenames that contain newlines,
but it's easy to fix:

du() { env du "$@" --block-size=3D1 --null | numfmt --zero-terminated
--from=3Dauto --to=3Diec-i --suffix=3DB | tr '\0' '\n'; }

--=20
https://rrt.sc3d.org

--000000000000f4695106172c0a5f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><span class=3D"gmail_default" style=3D"font-family:arial,h=
elvetica,sans-serif;font-size:small"></span><span class=3D"gmail_default" s=
tyle=3D"font-family:arial,helvetica,sans-serif;font-size:small"></span>On F=
ri, 23 May 2014 at 15:02, Reuben Thomas &lt;<a href=3D"mailto:rrt@HIDDEN"=
 target=3D"_blank">rrt@HIDDEN</a>&gt; wrote:<div class=3D"gmail_quote"><d=
iv><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:=
1ex"><div>On 23 May 2014 13:12, P=C3=A1draig Brady <span dir=3D"ltr">&lt;<a=
 href=3D"mailto:P@HIDDEN" target=3D"_blank">P@HIDDEN</a>&gt=
;</span> wrote:<br><div class=3D"gmail_extra"><div class=3D"gmail_quote"><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">
<span class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-ser=
if;font-size:small"></span>tl;dr<br>
<br>
<span class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-ser=
if;font-size:small"></span>=C2=A0 You can get what you want currently by do=
ing:<br>
<span class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-ser=
if;font-size:small"></span><br>
=C2=A0 =C2=A0 du() { env du -B1 &quot;$@&quot; | numfmt --to=3Diec-i --suff=
ix=3DB; }<br></blockquote><div><br></div><div>Thanks very much, that&#39;s =
certainly good enough for me.<br></div></div></div></div></blockquote><div>=
<br></div><div><div style=3D"font-family:arial,helvetica,sans-serif;font-si=
ze:small">Today I found that this doesn&#39;t cope with filenames that cont=
ain newlines, but it&#39;s easy to fix:</div><div style=3D"font-family:aria=
l,helvetica,sans-serif;font-size:small"><br></div><div style=3D"font-family=
:arial,helvetica,sans-serif;font-size:small"><span class=3D"gmail_default" =
style=3D"font-family:arial,helvetica,sans-serif;font-size:small"></span>du(=
) { env du &quot;$@&quot; --block-size=3D1 --null | numfmt --zero-terminate=
d --from=3Dauto --to=3Diec-i --suffix=3DB | tr &#39;\0&#39; &#39;\n&#39;; }=
</div></div><br clear=3D"all"></div></div></div><span class=3D"gmail_signat=
ure_prefix">-- </span><span class=3D"gmail_default" style=3D"font-family:ar=
ial,helvetica,sans-serif;font-size:small"></span><br><div class=3D"gmail_si=
gnature"><div><div><div><a href=3D"https://rrt.sc3d.org" target=3D"_blank">=
https://rrt.sc3d.org</a></div></div></div></div></div>

--000000000000f4695106172c0a5f--




Information forwarded to bug-coreutils@HIDDEN:
bug#17553; Package coreutils. Full text available.
bug unarchived. Request was from Reuben Thomas <rrt@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug archived. Request was from Debbugs Internal Request <help-debbugs@HIDDEN> to internal_control <at> debbugs.gnu.org. Full text available.
Disconnected #18503 from all other report(s). Request was from Pádraig Brady <P@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Forcibly Merged 17553 18503. Request was from Pádraig Brady <P@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug unarchived. Request was from Pádraig Brady <P@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug archived. Request was from Debbugs Internal Request <help-debbugs@HIDDEN> to internal_control <at> debbugs.gnu.org. Full text available.
bug closed, send any further explanations to 17553 <at> debbugs.gnu.org and Reuben Thomas <rrt@HIDDEN> Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) notabug. Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 17553 <at> debbugs.gnu.org:


Received: (at 17553) by debbugs.gnu.org; 23 May 2014 13:02:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 23 09:02:50 2014
Received: from localhost ([127.0.0.1]:57413 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Wnp7a-0002ET-6F
	for submit <at> debbugs.gnu.org; Fri, 23 May 2014 09:02:50 -0400
Received: from mail-la0-f50.google.com ([209.85.215.50]:45651)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <rrt@HIDDEN>) id 1Wnp7X-0002EC-Dk
 for 17553 <at> debbugs.gnu.org; Fri, 23 May 2014 09:02:48 -0400
Received: by mail-la0-f50.google.com with SMTP id b8so4189366lan.9
 for <17553 <at> debbugs.gnu.org>; Fri, 23 May 2014 06:02:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google;
 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
 :cc:content-type;
 bh=8S4gPctTuY5Az2Ex+SM/vB8fW9l/n3fptKWGcMTYAeI=;
 b=udxPig+yOURl48OOzRNoI+OEtcnD3kgVC7JdJCk0KKBB7rH/9Ab/6Gr31vzIdSCIsz
 2T29ZoT9AkbwdYcqx+RRORwSqhOWNR/8F1Vt+hCZxGa/U+1GxzAN0UODg4E1UxIKdryJ
 y77eKCp5dPR2KKSErflrFP1UMl2Y9h0IcHRdU=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:in-reply-to:references:date
 :message-id:subject:from:to:cc:content-type;
 bh=8S4gPctTuY5Az2Ex+SM/vB8fW9l/n3fptKWGcMTYAeI=;
 b=CtcI9P6ynJav4o/J9ws4NY0bqA4XfL9/V8UyrEQZAUtOJLDZuSHsaYn/0PXchQWRUV
 cSeBC7rvsbZ3VUYICR/6Xjzx4A8Ok9wCY8DkW7QpJ1kBk5wiTQBiwlJnZF1kKYK79TXl
 BbZ+H2sdKvW6yWyge9+UB0cwodijsGphcpVjdYLlgQmSxge++8Fqn7fMzNjg9fiJeJCE
 9YuGktpoA/MafmzX9SkojQHce04lsyRSbHhMIZJbNyvgMDJE0YwjrEBLmeL9DODwI52D
 jZlo6AXVDXx2SNN3BzHWsZEzg8kIwSOJjSvonvweyjFBDOjfKfpCitcHh0tk4nJIGwCJ
 6t1A==
X-Gm-Message-State: ALoCoQlhY+cMO4d064YjnFbVZpiV9jiHjmEZ347JlKT/i8cNlmiKr4yP7b8xC47WfCW1XuONCCGL
MIME-Version: 1.0
X-Received: by 10.152.21.202 with SMTP id x10mr3343238lae.3.1400850160963;
 Fri, 23 May 2014 06:02:40 -0700 (PDT)
Received: by 10.152.166.103 with HTTP; Fri, 23 May 2014 06:02:40 -0700 (PDT)
In-Reply-To: <537F3B2D.9090600@HIDDEN>
References: <CAOnWdoiz9q7J5BnvTJnKZURc=MAc-Lauh1246KXfN_kK7cOAZw@HIDDEN>
 <537E80FF.2040603@HIDDEN>
 <CAOnWdogi5Dz=ohyz_Cj4pF9K0211p0h-5QJO+zWPHoCESY3XJA@HIDDEN>
 <537F3B2D.9090600@HIDDEN>
Date: Fri, 23 May 2014 14:02:40 +0100
Message-ID: <CAOnWdojF0_BGRdu2CwwKQxdeOdB=ObK2WQmDvb7MWK1d=kbd5w@HIDDEN>
Subject: Re: bug#17553: du unit suggestion
From: Reuben Thomas <rrt@HIDDEN>
To: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN>
Content-Type: multipart/alternative; boundary=089e0158ab683a63c604fa10d8a1
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 17553
Cc: 17553 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

--089e0158ab683a63c604fa10d8a1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 23 May 2014 13:12, P=C3=A1draig Brady <P@HIDDEN> wrote:

> tl;dr
>
>   You can get what you want currently by doing:
>
>     du() { env du -B1 "$@" | numfmt --to=3Diec-i --suffix=3DB; }
>

Thanks very much, that's certainly good enough for me.

My understanding of the rest of what you wrote is that fixing the
inconsistency in du's output is complicated by backwards compatibility, and
because the code used to do so is used elsewhere in coreutils. Pity. It'd
certainly be nice to see consistent output by default.

With -B '..B' output you mean?
>

Sorry, yes.

Thanks very much for your efforts.

--089e0158ab683a63c604fa10d8a1
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On 23 May 2014 13:12, P=C3=A1draig Brady <span dir=3D"ltr"=
>&lt;<a href=3D"mailto:P@HIDDEN" target=3D"_blank">P@HIDDEN=
</a>&gt;</span> wrote:<br><div class=3D"gmail_extra"><div class=3D"gmail_qu=
ote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bo=
rder-left:1px solid rgb(204,204,204);padding-left:1ex">
tl;dr<br>
<br>
=C2=A0 You can get what you want currently by doing:<br>
<br>
=C2=A0 =C2=A0 du() { env du -B1 &quot;$@&quot; | numfmt --to=3Diec-i --suff=
ix=3DB; }<br></blockquote><div><br></div><div>Thanks very much, that&#39;s =
certainly good enough for me.<br><br></div><div>My understanding of the res=
t of what you wrote is that=20
fixing the inconsistency in du&#39;s output is complicated by backwards=20
compatibility, and because the code used to do so is used elsewhere in=20
coreutils. Pity. It&#39;d certainly be nice to see consistent output by def=
ault.<br><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0p=
x 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">With -=
B &#39;..B&#39; output you mean?<br>
</blockquote><div><br></div><div>Sorry, yes.<br></div><div><br></div><div>T=
hanks very much for your efforts.<br></div></div></div></div>

--089e0158ab683a63c604fa10d8a1--




Information forwarded to bug-coreutils@HIDDEN:
bug#17553; Package coreutils. Full text available.

Message received at 17553 <at> debbugs.gnu.org:


Received: (at 17553) by debbugs.gnu.org; 23 May 2014 12:12:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 23 08:12:46 2014
Received: from localhost ([127.0.0.1]:57401 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WnoL4-0000gc-K2
	for submit <at> debbugs.gnu.org; Fri, 23 May 2014 08:12:46 -0400
Received: from mail2.vodafone.ie ([213.233.128.44]:23057)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <P@HIDDEN>) id 1WnoKy-0000g2-PJ
 for 17553 <at> debbugs.gnu.org; Fri, 23 May 2014 08:12:40 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AqABADI6f1NtTtJP/2dsb2JhbAANTINZg0KqWJcCAYEfgxkBAQEDASNWBQsLDQEKCRYLAgIJAwIBAgFFBg0BBQIBAYg1DQixNHelLheOBEkFBwmCbIFLBI1Vg3aBOogqhVdWjnZs
Received: from unknown (HELO [192.168.1.79]) ([109.78.210.79])
 by mail2.vodafone.ie with ESMTP; 23 May 2014 13:12:30 +0100
Message-ID: <537F3B2D.9090600@HIDDEN>
Date: Fri, 23 May 2014 13:12:29 +0100
From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= <P@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:17.0) Gecko/20130110 Thunderbird/17.0.2
MIME-Version: 1.0
To: Reuben Thomas <rrt@HIDDEN>
Subject: Re: bug#17553: du unit suggestion
References: <CAOnWdoiz9q7J5BnvTJnKZURc=MAc-Lauh1246KXfN_kK7cOAZw@HIDDEN>
 <537E80FF.2040603@HIDDEN>
 <CAOnWdogi5Dz=ohyz_Cj4pF9K0211p0h-5QJO+zWPHoCESY3XJA@HIDDEN>
In-Reply-To: <CAOnWdogi5Dz=ohyz_Cj4pF9K0211p0h-5QJO+zWPHoCESY3XJA@HIDDEN>
X-Enigmail-Version: 1.6
Content-Type: multipart/mixed; boundary="------------040209060500070101030207"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 17553
Cc: 17553 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

This is a multi-part message in MIME format.
--------------040209060500070101030207
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

tl;dr

  You can get what you want currently by doing:

    du() { env du -B1 "$@" | numfmt --to=iec-i --suffix=B; }

  Though there are some potential changes.
  I'm 60:40 against applying the attached block-size-iec-iB.patch
  I'm 60:40 for applying the attached block-size-help-iB.patch

details below...

On 05/23/2014 11:13 AM, Reuben Thomas wrote:
> On 22 May 2014 23:58, Pádraig Brady <P@HIDDEN> wrote:
> 
>> On 05/22/2014 08:47 PM, Reuben Thomas wrote:
>>> It would be helpful to this addle-pated individual if du would output the
>>> same units as it accepts as SIZE inputs, so that one could more readily
>>> tell whether one was getting 1000-based or 1024-based units.
>>>
>>> For additional clarity, it would help if for output the suffix were "B"
>> as
>>> at present for 1000-based units and "iB" for 1024-based (and
>>> correspondingly it would be nice if "iB" suffixed units were accepted as
>>> input. As far as input goes, it's backwards-compatible; it's not for
>> output
>>> if other programs are trying to parse the human-readable output, but
>> maybe
>>> that's not a problem.
>>
>> Yes this is not ideal, but it half does what you want:
>> With this file:
>>
>>   $ truncate -s 1MiB file.in
>>
>> We can output the appropriate suffixes for a _particular_ power.
>>
>>   $ du --apparent-size -BKiB file.in
>>   1024KiB       file.in
>>   $ du --apparent-size -BKB file.in
>>   1049kB        file.in
>>
>> However if we want to auto scale the number with -h we lose the suffix,
>> and have an ambiguity:
>>
>>   $ du --apparent-size -h file.in
>>   1.0M  file.in
>>   $ du --apparent-size -h --si file.in
>>   1.1M  file.in
>>
>> If you wanted to get auto scaling with suffixes you could use
>> the new numfmt utility which has various number formatting options.
>> The advantage of that is it concentrates the myriad of number formatting
>> options in a single location, and allows processing of numbers before
>> final presentation by numfmt. For example:
>>
>>   $ du -B1 . | sort -k1,1n | numfmt --to=iec-i | tail -n5
>>   104Mi ./gnulib/.git/objects/pack
>>   216Mi ./gnulib/.git/objects
>>   218Mi ./gnulib/.git
>>   274Mi ./gnulib
>>   479Mi .
>>
> 
> Thanks for clarifying what is possible. Currently du's behaviour is more
> inconsistent than I'd realised. I see that if one wanted more complicated
> units it would make sense to use an external utility, but here I'd just
> like -h's output to be consistent with --apparent-size's output.

With -B '..B' output you mean?

To show all current output possibilities:

$ dd bs=1MiB count=2 if=/dev/zero of=file.test
$ for B in 1 1000 1024 KB KiB si human; do
    printf '%s (%s)\n' "$(du -B$B file.test)" "$B"
  done
2097152	file.test (1)
2098	file.test (1000)
2048	file.test (1024)
2098kB	file.test (KB)
2048KiB	file.test (KiB)
2.1M	file.test (si)
2.0M	file.test (human)

For backward compat I'm a bit reluctant to have -h (or -Bhuman)
without --si output the 'i' suffix. It is tempting though,
but another reason not to do this, is the current implementation
would also output the 'B' suffix, which might be OK for du,
but we also need to consider ls and df where this is also significant.

I guess we could extend the --block-size option to support this
(simple patch is attached)

$ for B in iec-iB si-B; do printf '%s (%s)\n' "$(src/du -B$B file.test)" "$B"; done
2.0MiB	file.test (iec-iB)
2.1MB	file.test (si-B)

However as mentioned the current implementation of this doesn't support
outputting the 'i' iec distinguishing char without the 'B' suffix.
Also given the messiness in this area I'm reluctant to add to it.
numfmt gives all the flexibility you need here and you can setup:

  du() { env du -B1 "$@" | numfmt --to=iec-i --suffix=B; }

That would be more general and just about as awkward as:

  alias du='du -Biec-iB'

> It seems that -iB suffixed units are already accepted as input, which was
> my second request, but not documented in the man page. I'd like to fix
> this, but without duplicating information. What's best: to add a phrase
> saying that SI units are accepted and/or to make a cross-reference to the
> relevant node of the info manual?

Yes the man page doesn't mention that the integer is optional and
the consequences of that, nor does it mention the 'human' and 'si' possibilities.
Man pages are a tricky to have the right level of info.
BTW having the integer optional was removed from the description in:
  http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9939#53
I've attached a proposed patch to show the -B'MiB' as an option,
while leaving the SIZE description as before.

thanks,
Pádraig.

--------------040209060500070101030207
Content-Type: text/x-patch;
 name="block-size-iec-iB.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="block-size-iec-iB.patch"

diff --git a/lib/human.c b/lib/human.c
index ab6b30d..d5d5a79 100644
--- a/lib/human.c
+++ b/lib/human.c
@@ -394,11 +394,20 @@ human_readable (uintmax_t n, char *buf, int opts,
 # define DEFAULT_BLOCK_SIZE 1024
 #endif
 
-static char const *const block_size_args[] = { "human-readable", "si", 0 };
+static char const *const block_size_args[] =
+  {
+    "human-readable",
+    "iec-iB",
+    "si",
+    "si-B",
+    0 };
+
 static int const block_size_opts[] =
   {
     human_autoscale + human_SI + human_base_1024,
-    human_autoscale + human_SI
+    human_autoscale + human_SI + human_base_1024 + human_B,
+    human_autoscale + human_SI,
+    human_autoscale + human_SI + human_B
   };
 
 static uintmax_t

--------------040209060500070101030207
Content-Type: text/x-patch;
 name="block-size-help-iB.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="block-size-help-iB.patch"

diff --git a/src/df.c b/src/df.c
index 01ecca6..8941632 100644
--- a/src/df.c
+++ b/src/df.c
@@ -1276,7 +1276,7 @@ or all file systems by default.\n\
       fputs (_("\
   -a, --all             include dummy file systems\n\
   -B, --block-size=SIZE  scale sizes by SIZE before printing them; e.g.,\n\
-                           '-BM' prints sizes in units of 1,048,576 bytes;\n\
+                           '-BMiB' prints sizes in units of 1,048,576 bytes;\n\
                            see SIZE format below\n\
       --total           produce a grand total\n\
   -h, --human-readable  print sizes in powers of 1024 (e.g., 1023M)\n\
diff --git a/src/du.c b/src/du.c
index 890edb6..215cb21 100644
--- a/src/du.c
+++ b/src/du.c
@@ -299,7 +299,7 @@ Summarize disk usage of each FILE, recursively for directories.\n\
 "), stdout);
       fputs (_("\
   -B, --block-size=SIZE  scale sizes by SIZE before printing them; e.g.,\n\
-                           '-BM' prints sizes in units of 1,048,576 bytes;\n\
+                           '-BMiB' prints sizes in units of 1,048,576 bytes;\n\
                            see SIZE format below\n\
   -b, --bytes           equivalent to '--apparent-size --block-size=1'\n\
   -c, --total           produce a grand total\n\
diff --git a/src/ls.c b/src/ls.c
index 25e10fa..6f5fef7 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -4793,7 +4793,7 @@ Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n\
 "), stdout);
       fputs (_("\
       --block-size=SIZE      scale sizes by SIZE before printing them; e.g.,\n\
-                               '--block-size=M' prints sizes in units of\n\
+                               '--block-size=MiB' prints sizes in units of\n\
                                1,048,576 bytes; see SIZE format below\n\
   -B, --ignore-backups       do not list implied entries ending with ~\n\
   -c                         with -lt: sort by, and show, ctime (time of last\n\

--------------040209060500070101030207--




Information forwarded to bug-coreutils@HIDDEN:
bug#17553; Package coreutils. Full text available.

Message received at 17553 <at> debbugs.gnu.org:


Received: (at 17553) by debbugs.gnu.org; 23 May 2014 10:13:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 23 06:13:12 2014
Received: from localhost ([127.0.0.1]:57319 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WnmTP-0004PO-Ao
	for submit <at> debbugs.gnu.org; Fri, 23 May 2014 06:13:11 -0400
Received: from mail-la0-f47.google.com ([209.85.215.47]:47451)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <rrt@HIDDEN>) id 1WnmTM-0004PA-Hl
 for 17553 <at> debbugs.gnu.org; Fri, 23 May 2014 06:13:09 -0400
Received: by mail-la0-f47.google.com with SMTP id pn19so3895384lab.6
 for <17553 <at> debbugs.gnu.org>; Fri, 23 May 2014 03:13:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google;
 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
 :cc:content-type;
 bh=BJWgvC9eNxEDtOW7LRCmeA5mA9LUXZ4vcU6Cbxt9IXo=;
 b=K2Dy7sFavtpQEt9uDesNuUB5diRppGP9MITVYjnRkdovhDBWVNvPx1Up0jG4hOcn01
 w7j2VyvyNUZA5sLEKaQZ1ElAv7gFcpGD0KmiR9eEKY/MY4wPzo1nX87pxgsM7Ri+xuhG
 /KOuS2jAyyn+WGna5J4lGJ0QQqwUcWr9BI9/8=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:in-reply-to:references:date
 :message-id:subject:from:to:cc:content-type;
 bh=BJWgvC9eNxEDtOW7LRCmeA5mA9LUXZ4vcU6Cbxt9IXo=;
 b=Bl+r4jde5v24MGQpnImO33GSfJQI4yvk5XB5yk6qqcyQ93Jx/3DI1CVGjuGxzDARXX
 LXim14P1p+6lXc6hw7pRMWwAqh6inJgh+2nPDrylmaUpjQWHcFJ5OSHzppVBvF8oWyKh
 qZGG7PSgffyoAKUy29enVgUP9txXtliBTZHitpF0hQ7gN3z37Q7lCmIWJiZ3tbCEFXm3
 bni0M+xgBP1XYE/7s+ik9oCcfFvaM97maBuB3Guxv5q8XVwYMGXFFvpqNQFsJeVxL6OA
 9q8Z1i8BX1vPzYfUArQ+vAeGL2SRPen15ORIw8b4YATTooIgB2HqosVNH0W5ZKe1R+4E
 JnDw==
X-Gm-Message-State: ALoCoQmdFkA75p9/xExZ3Lnr1y5MQxtr5odKb03GBekfvlKphgaY9jqPeazT3OgB4cBEhGy7L65P
MIME-Version: 1.0
X-Received: by 10.152.23.6 with SMTP id i6mr2769766laf.24.1400839982431; Fri,
 23 May 2014 03:13:02 -0700 (PDT)
Received: by 10.152.166.103 with HTTP; Fri, 23 May 2014 03:13:02 -0700 (PDT)
In-Reply-To: <537E80FF.2040603@HIDDEN>
References: <CAOnWdoiz9q7J5BnvTJnKZURc=MAc-Lauh1246KXfN_kK7cOAZw@HIDDEN>
 <537E80FF.2040603@HIDDEN>
Date: Fri, 23 May 2014 11:13:02 +0100
Message-ID: <CAOnWdogi5Dz=ohyz_Cj4pF9K0211p0h-5QJO+zWPHoCESY3XJA@HIDDEN>
Subject: Re: bug#17553: du unit suggestion
From: Reuben Thomas <rrt@HIDDEN>
To: =?UTF-8?Q?P=C3=A1draig_Brady?= <P@HIDDEN>
Content-Type: multipart/alternative; boundary=089e0160bbee8a515604fa0e79ad
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 17553
Cc: 17553 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

--089e0160bbee8a515604fa0e79ad
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 22 May 2014 23:58, P=C3=A1draig Brady <P@HIDDEN> wrote:

> On 05/22/2014 08:47 PM, Reuben Thomas wrote:
> > It would be helpful to this addle-pated individual if du would output t=
he
> > same units as it accepts as SIZE inputs, so that one could more readily
> > tell whether one was getting 1000-based or 1024-based units.
> >
> > For additional clarity, it would help if for output the suffix were "B"
> as
> > at present for 1000-based units and "iB" for 1024-based (and
> > correspondingly it would be nice if "iB" suffixed units were accepted a=
s
> > input. As far as input goes, it's backwards-compatible; it's not for
> output
> > if other programs are trying to parse the human-readable output, but
> maybe
> > that's not a problem.
>
> Yes this is not ideal, but it half does what you want:
> With this file:
>
>   $ truncate -s 1MiB file.in
>
> We can output the appropriate suffixes for a _particular_ power.
>
>   $ du --apparent-size -BKiB file.in
>   1024KiB       file.in
>   $ du --apparent-size -BKB file.in
>   1049kB        file.in
>
> However if we want to auto scale the number with -h we lose the suffix,
> and have an ambiguity:
>
>   $ du --apparent-size -h file.in
>   1.0M  file.in
>   $ du --apparent-size -h --si file.in
>   1.1M  file.in
>
> If you wanted to get auto scaling with suffixes you could use
> the new numfmt utility which has various number formatting options.
> The advantage of that is it concentrates the myriad of number formatting
> options in a single location, and allows processing of numbers before
> final presentation by numfmt. For example:
>
>   $ du -B1 . | sort -k1,1n | numfmt --to=3Diec-i | tail -n5
>   104Mi ./gnulib/.git/objects/pack
>   216Mi ./gnulib/.git/objects
>   218Mi ./gnulib/.git
>   274Mi ./gnulib
>   479Mi .
>

Thanks for clarifying what is possible. Currently du's behaviour is more
inconsistent than I'd realised. I see that if one wanted more complicated
units it would make sense to use an external utility, but here I'd just
like -h's output to be consistent with --apparent-size's output.

It seems that -iB suffixed units are already accepted as input, which was
my second request, but not documented in the man page. I'd like to fix
this, but without duplicating information. What's best: to add a phrase
saying that SI units are accepted and/or to make a cross-reference to the
relevant node of the info manual?

--=20
http://rrt.sc3d.org

--089e0160bbee8a515604fa0e79ad
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On 2=
2 May 2014 23:58, P=C3=A1draig Brady <span dir=3D"ltr">&lt;<a href=3D"mailt=
o:P@HIDDEN" target=3D"_blank">P@HIDDEN</a>&gt;</span> wrote=
:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le=
ft:1px #ccc solid;padding-left:1ex">
On 05/22/2014 08:47 PM, Reuben Thomas wrote:<br>
&gt; It would be helpful to this addle-pated individual if du would output =
the<br>
&gt; same units as it accepts as SIZE inputs, so that one could more readil=
y<br>
&gt; tell whether one was getting 1000-based or 1024-based units.<br>
&gt;<br>
&gt; For additional clarity, it would help if for output the suffix were &q=
uot;B&quot; as<br>
&gt; at present for 1000-based units and &quot;iB&quot; for 1024-based (and=
<br>
&gt; correspondingly it would be nice if &quot;iB&quot; suffixed units were=
 accepted as<br>
&gt; input. As far as input goes, it&#39;s backwards-compatible; it&#39;s n=
ot for output<br>
&gt; if other programs are trying to parse the human-readable output, but m=
aybe<br>
&gt; that&#39;s not a problem.<br>
<br>
Yes this is not ideal, but it half does what you want:<br>
With this file:<br>
<br>
=C2=A0 $ truncate -s 1MiB <a href=3D"http://file.in" target=3D"_blank">file=
.in</a><br>
<br>
We can output the appropriate suffixes for a _particular_ power.<br>
<br>
=C2=A0 $ du --apparent-size -BKiB <a href=3D"http://file.in" target=3D"_bla=
nk">file.in</a><br>
=C2=A0 1024KiB =C2=A0 =C2=A0 =C2=A0 <a href=3D"http://file.in" target=3D"_b=
lank">file.in</a><br>
=C2=A0 $ du --apparent-size -BKB <a href=3D"http://file.in" target=3D"_blan=
k">file.in</a><br>
=C2=A0 1049kB =C2=A0 =C2=A0 =C2=A0 =C2=A0<a href=3D"http://file.in" target=
=3D"_blank">file.in</a><br>
<br>
However if we want to auto scale the number with -h we lose the suffix,<br>
and have an ambiguity:<br>
<br>
=C2=A0 $ du --apparent-size -h <a href=3D"http://file.in" target=3D"_blank"=
>file.in</a><br>
=C2=A0 1.0M =C2=A0<a href=3D"http://file.in" target=3D"_blank">file.in</a><=
br>
=C2=A0 $ du --apparent-size -h --si <a href=3D"http://file.in" target=3D"_b=
lank">file.in</a><br>
=C2=A0 1.1M =C2=A0<a href=3D"http://file.in" target=3D"_blank">file.in</a><=
br>
<br>
If you wanted to get auto scaling with suffixes you could use<br>
the new numfmt utility which has various number formatting options.<br>
The advantage of that is it concentrates the myriad of number formatting<br=
>
options in a single location, and allows processing of numbers before<br>
final presentation by numfmt. For example:<br>
<br>
=C2=A0 $ du -B1 . | sort -k1,1n | numfmt --to=3Diec-i | tail -n5<br>
=C2=A0 104Mi ./gnulib/.git/objects/pack<br>
=C2=A0 216Mi ./gnulib/.git/objects<br>
=C2=A0 218Mi ./gnulib/.git<br>
=C2=A0 274Mi ./gnulib<br>
=C2=A0 479Mi .<br></blockquote><div><br></div><div>Thanks for clarifying wh=
at is possible. Currently du&#39;s behaviour is more inconsistent than I&#3=
9;d realised. I see that if one wanted more complicated units it would make=
 sense to use an external utility, but here I&#39;d just like -h&#39;s outp=
ut to be consistent with --apparent-size&#39;s output.<br>
<br>It seems that -iB suffixed units are already accepted as input, which w=
as my second request, but not documented in the man page. I&#39;d like to f=
ix this, but without duplicating information. What&#39;s best: to add a phr=
ase saying that SI units are accepted and/or to make a cross-reference to t=
he relevant node of the info manual?<br>
</div></div><br>-- <br><a href=3D"http://rrt.sc3d.org">http://rrt.sc3d.org<=
/a>
</div></div>

--089e0160bbee8a515604fa0e79ad--




Information forwarded to bug-coreutils@HIDDEN:
bug#17553; Package coreutils. Full text available.

Message received at 17553 <at> debbugs.gnu.org:


Received: (at 17553) by debbugs.gnu.org; 22 May 2014 22:58:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 22 18:58:18 2014
Received: from localhost ([127.0.0.1]:57011 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WnbwI-0001Vf-6j
	for submit <at> debbugs.gnu.org; Thu, 22 May 2014 18:58:18 -0400
Received: from mail2.vodafone.ie ([213.233.128.44]:9127)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <P@HIDDEN>) id 1WnbwF-0001VQ-TY
 for 17553 <at> debbugs.gnu.org; Thu, 22 May 2014 18:58:16 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AtkBAFWAflNtTXub/2dsb2JhbAANTINZg0KqQJcBAYEkgxkBAQEEIw8BRhALDQEKAgIFFgsCAgkDAgECAUUGDQEHAQGIQrEOd6UsF4EqjFZOB4J1gUsBA5suhVePSw
Received: from unknown (HELO [192.168.1.79]) ([109.77.123.155])
 by mail2.vodafone.ie with ESMTP; 22 May 2014 23:58:09 +0100
Message-ID: <537E80FF.2040603@HIDDEN>
Date: Thu, 22 May 2014 23:58:07 +0100
From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= <P@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:17.0) Gecko/20130110 Thunderbird/17.0.2
MIME-Version: 1.0
To: Reuben Thomas <rrt@HIDDEN>
Subject: Re: bug#17553: du unit suggestion
References: <CAOnWdoiz9q7J5BnvTJnKZURc=MAc-Lauh1246KXfN_kK7cOAZw@HIDDEN>
In-Reply-To: <CAOnWdoiz9q7J5BnvTJnKZURc=MAc-Lauh1246KXfN_kK7cOAZw@HIDDEN>
X-Enigmail-Version: 1.6
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 17553
Cc: 17553 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

On 05/22/2014 08:47 PM, Reuben Thomas wrote:
> It would be helpful to this addle-pated individual if du would output the
> same units as it accepts as SIZE inputs, so that one could more readily
> tell whether one was getting 1000-based or 1024-based units.
> 
> For additional clarity, it would help if for output the suffix were "B" as
> at present for 1000-based units and "iB" for 1024-based (and
> correspondingly it would be nice if "iB" suffixed units were accepted as
> input. As far as input goes, it's backwards-compatible; it's not for output
> if other programs are trying to parse the human-readable output, but maybe
> that's not a problem.

Yes this is not ideal, but it half does what you want:
With this file:

  $ truncate -s 1MiB file.in

We can output the appropriate suffixes for a _particular_ power.

  $ du --apparent-size -BKiB file.in
  1024KiB	file.in
  $ du --apparent-size -BKB file.in
  1049kB	file.in

However if we want to auto scale the number with -h we lose the suffix,
and have an ambiguity:

  $ du --apparent-size -h file.in
  1.0M	file.in
  $ du --apparent-size -h --si file.in
  1.1M	file.in

If you wanted to get auto scaling with suffixes you could use
the new numfmt utility which has various number formatting options.
The advantage of that is it concentrates the myriad of number formatting
options in a single location, and allows processing of numbers before
final presentation by numfmt. For example:

  $ du -B1 . | sort -k1,1n | numfmt --to=iec-i | tail -n5
  104Mi ./gnulib/.git/objects/pack
  216Mi ./gnulib/.git/objects
  218Mi ./gnulib/.git
  274Mi ./gnulib
  479Mi .

thanks,
Pádraig.




Information forwarded to bug-coreutils@HIDDEN:
bug#17553; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 22 May 2014 19:47:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 22 15:47:50 2014
Received: from localhost ([127.0.0.1]:56898 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WnYxu-0002xJ-32
	for submit <at> debbugs.gnu.org; Thu, 22 May 2014 15:47:50 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41212)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <rrt@HIDDEN>) id 1WnYxo-0002ws-L7
 for submit <at> debbugs.gnu.org; Thu, 22 May 2014 15:47:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <rrt@HIDDEN>) id 1WnYxi-0004Iw-GV
 for submit <at> debbugs.gnu.org; Thu, 22 May 2014 15:47:35 -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.0 required=5.0 tests=BAYES_20,HTML_MESSAGE,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:50894)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rrt@HIDDEN>)
 id 1WnYxi-0004Is-DC
 for submit <at> debbugs.gnu.org; Thu, 22 May 2014 15:47:34 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:42926)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <rrt@HIDDEN>) id 1WnYxh-0002mC-Bu
 for bug-coreutils@HIDDEN; Thu, 22 May 2014 15:47:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <rrt@HIDDEN>) id 1WnYxg-0004IR-Dr
 for bug-coreutils@HIDDEN; Thu, 22 May 2014 15:47:33 -0400
Received: from mail-la0-x235.google.com ([2a00:1450:4010:c03::235]:36873)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rrt@HIDDEN>)
 id 1WnYxg-0004Hh-4J
 for bug-coreutils@HIDDEN; Thu, 22 May 2014 15:47:32 -0400
Received: by mail-la0-f53.google.com with SMTP id ty20so1493455lab.26
 for <bug-coreutils@HIDDEN>; Thu, 22 May 2014 12:47:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google;
 h=mime-version:date:message-id:subject:from:to:content-type;
 bh=AOQnszw+Yl2ZkChJhey+jKWyJH8F0VPjFn9QMP0+v2U=;
 b=WGfvMIbkDTRP8R6cdxdM1loTFz1PSoWZwZLrC9lp7cPq9TORYq2EdizYFusUde2df9
 TKCj3SfUXSmCb1G7E2sugSx/V6dvIZ8DUz4NjJA14HzZmNfGhYmW8jvo7K+74sFlwaZ6
 uvaEb9V4p/iMGXme6w+uvb1Sc9rd6wXmiZlVw=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:date:message-id:subject:from:to
 :content-type;
 bh=AOQnszw+Yl2ZkChJhey+jKWyJH8F0VPjFn9QMP0+v2U=;
 b=GF0XoimqNYPqXZfDwmMdOcLf5K7HhoU3BL0x9mzxZCJ6Kupj2L0DXRx1StfHnSnkjN
 gfyxkkG6rlVFES7oODPWA7E204W+6SOB4dgn2F1rR20iV6VLEwl8lmdE8/Ud9dJS9p0E
 8kT03T32gbzpaQisC9bjLERTO531hy/vA+KYtg7PCv/a1JRz2h5aDqiN2wOOXxeOInnZ
 Rg7BYip7EQfeWKazocOVEB6a7lqDJ2mR7Vk2E5orETxzv1bcmziOpuSbKxQhyNVWtSGj
 rl8pMc1RJlz6tau3//IT03e+3jJ98rKS92NfoKD08qa/BYmqdbim5nWOxOV4vDoJD6PZ
 bjLw==
X-Gm-Message-State: ALoCoQl3ydgsAe4oGNT6pW3hOVUBALM+bt6pqB8ccJtZm27ubvyXCXnTbo5NcJrbxYQuUg5ZqtZu
MIME-Version: 1.0
X-Received: by 10.152.23.136 with SMTP id m8mr2871laf.2.1400788049646; Thu, 22
 May 2014 12:47:29 -0700 (PDT)
Received: by 10.152.166.103 with HTTP; Thu, 22 May 2014 12:47:29 -0700 (PDT)
Date: Thu, 22 May 2014 20:47:29 +0100
Message-ID: <CAOnWdoiz9q7J5BnvTJnKZURc=MAc-Lauh1246KXfN_kK7cOAZw@HIDDEN>
Subject: du unit suggestion
From: Reuben Thomas <rrt@HIDDEN>
To: bug-coreutils <bug-coreutils@HIDDEN>
Content-Type: multipart/alternative; boundary=089e0158bf881aebf304fa02621d
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.1 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.1 (----)

--089e0158bf881aebf304fa02621d
Content-Type: text/plain; charset=UTF-8

It would be helpful to this addle-pated individual if du would output the
same units as it accepts as SIZE inputs, so that one could more readily
tell whether one was getting 1000-based or 1024-based units.

For additional clarity, it would help if for output the suffix were "B" as
at present for 1000-based units and "iB" for 1024-based (and
correspondingly it would be nice if "iB" suffixed units were accepted as
input. As far as input goes, it's backwards-compatible; it's not for output
if other programs are trying to parse the human-readable output, but maybe
that's not a problem.

-- 
http://rrt.sc3d.org

--089e0158bf881aebf304fa02621d
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>It would be helpful to this addle-pated individual if=
 du would output the same units as it accepts as SIZE inputs, so that one c=
ould more readily tell whether one was getting 1000-based or 1024-based uni=
ts.<br>
<br></div>For additional clarity, it would help if for output the suffix we=
re &quot;B&quot; as at present for 1000-based units and &quot;iB&quot; for =
1024-based (and correspondingly it would be nice if &quot;iB&quot; suffixed=
 units were accepted as input. As far as input goes, it&#39;s backwards-com=
patible; it&#39;s not for output if other programs are trying to parse the =
human-readable output, but maybe that&#39;s not a problem.<br clear=3D"all"=
>
<div><div><div><div><br>-- <br><a href=3D"http://rrt.sc3d.org">http://rrt.s=
c3d.org</a>
</div></div></div></div></div>

--089e0158bf881aebf304fa02621d--




Acknowledgement sent to Reuben Thomas <rrt@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#17553; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 28 Apr 2024 18:15:01 UTC

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