Subject: bug#16922: df --si -h should emit a warning

From: Pádraig Brady <[email-masked]>
Date: Mon, 03 Mar 2014 11:35:44 +0000

On 03/03/2014 10:54 AM, Pádraig Brady wrote:
> On 03/03/2014 09:36 AM, Pádraig Brady wrote:
>> On 03/03/2014 04:55 AM, Paul Eggert wrote:
>>> Pádraig Brady wrote:
>>>> +  -h, --human-readable  print abbreviated sizes in powers of 1024 (e.g. %s)\n\
>>>> +  -H, --si              print abbreviated sizes in powers of 1000 (e.g. %s)\n\
>>>
>>> Thanks for looking into improving this.  Please put commas after "e.g.".  Also, I suggest removing "abbreviated", and simplifying the translator's job by simply interpolating the human.  E.g.:
>>>
>>> -h, --human-readable  print sizes in powers of 1024 (e.g., 1023M)\n\
>>> -H, --si              print sizes in powers of 1000 (e.g., 1.1G)\n\
>>
>> Better thanks.
>> I've rolled that into my local patch.
> 
> Actually I left the %s in the string to be replaced at runtime,
> so that 1.1G or 1,1G is output as appropriate.

I suppose it's better to err on the side of less code,
and let the translator adjust, assuming LC_MESSAGES == LC_NUMERIC.
The alternative edge case is probably not worth the extra code.

I'll push the attached soon.

thanks,
Pádraig.
>From 27466409bbdf75d3d2757a279b6042a521858626 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email-masked]>
Date: Mon, 3 Mar 2014 02:49:25 +0000
Subject: [PATCH] doc: improve df --human and --si, help and man page

* src/df.c (usage): Adjust the --human and --si descriptions
to not depend on each other.  Also include an example that is
illustrative of the rounding, suffix, width, and localized fractions.
* src/system.h (emit_size_note). Adjust so that it's obvious the
description is pertaining to the input SIZE argument, and not
to any sizes that might be output by df for example.
Fixes http://bugs.gnu.org/16922
---
 src/df.c     |    5 ++---
 src/system.h |    4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/df.c b/src/df.c
index e4fafb9..af41a0a 100644
--- a/src/df.c
+++ b/src/df.c
@@ -1266,9 +1266,8 @@ or all file systems by default.\n\
                            '-BM' 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 human readable format (e.g., 1K 234M 2G)\
-\n\
-  -H, --si              likewise, but use powers of 1000 not 1024\n\
+  -h, --human-readable  print sizes in powers of 1024 (e.g., 1023M)\n\
+  -H, --si              print sizes in powers of 1000 (e.g., 1.1G)\n\
 "), stdout);
       fputs (_("\
   -i, --inodes          list inode information instead of block usage\n\
diff --git a/src/system.h b/src/system.h
index 39750e8..a9588e7 100644
--- a/src/system.h
+++ b/src/system.h
@@ -549,8 +549,8 @@ static inline void
 emit_size_note (void)
 {
   fputs (_("\n\
-SIZE is an integer and optional unit (example: 10M is 10*1024*1024).  Units\n\
-are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (powers of 1000).\n\
+The SIZE argument is an integer and optional unit (example: 10K is 10*1024).\n\
+Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000).\n\
 "), stdout);
 }
 
-- 
1.7.7.6