Subject: bug#14525: ls -k produced no size, ls -lk lists in bytes? What's up w/k?

From: Pádraig Brady <[email-masked]>
Date: Tue, 26 Nov 2013 15:53:58 +0000

On 06/04/2013 08:40 PM, Eric Blake wrote:
> On 06/02/2013 12:47 PM, Paul Eggert wrote:
>> On 06/01/2013 02:54 PM, Linda Walsh wrote:
>>> ... removing features that exceeded posix
>>
>> As I explained to you in my previous message, no features
>> were removed.  Merely the option syntax was changed.
>>
>>> What switch(es) are supposed to be used to choose what units to display
>>> sizes on the long listing?
>>
>> The --block-size option.  See:
>>
>> http://www.gnu.org/software/coreutils/manual/coreutils.html#Block-size
>>
>> Coreutils already has all the features that you asked for
>> in your email.
> 
> I just noticed that we DO have a doc bug; in 'info coreutils "Block
> size"', we incorrectly claim:
> 
>>> Block size defaults can be overridden by an explicit
>>> `--block-size=SIZE' option.  The `-k' option is equivalent to
>>> `--block-size=1K', which is the default unless the `POSIXLY_CORRECT'
>>> environment variable is set. 
> 
> which, while still true for du and df, is now false for ls.
> 

Doc update attached.

thanks,
Pádraig.
>From 17bce8c63e9e0f85b48ca62b63413ce9102af5c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email-masked]>
Date: Tue, 26 Nov 2013 15:32:39 +0000
Subject: [PATCH] doc: clarify the operation of ls -k

* src/ls.c (usage): Mention -k only changes the display
for disk usage (directory total, and ls -s), and imply
that it can be overridden (by --block-size, and -h).
* doc/coreutils.texi (block size): Mention that ls -k
handling is different to other utilities.
Addresses http://bugs.gnu.org/14525
---
 doc/coreutils.texi |    4 +++-
 src/ls.c           |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 64713dc..67feb12 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -1012,7 +1012,9 @@ option is equivalent to @option{--block-size=1K}, which
 is the default unless the @env{POSIXLY_CORRECT} environment variable is
 set.  The @option{-h} or @option{--human-readable} option is equivalent to
 @option{--block-size=human-readable}.  The @option{--si} option is
-equivalent to @option{--block-size=si}.
+equivalent to @option{--block-size=si}.  Note for @command{ls}
+the @option{-k} option does not control the display of the
+apparent file sizes, whereas the @option{--block-size} option does.
 
 @node Floating point
 @section Floating point numbers
diff --git a/src/ls.c b/src/ls.c
index 512d65e..e7d1d93 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -4816,7 +4816,7 @@ Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n\
   -i, --inode                print the index number of each file\n\
   -I, --ignore=PATTERN       do not list implied entries matching shell PATTERN\
 \n\
-  -k, --kibibytes            use 1024-byte blocks\n\
+  -k, --kibibytes            default to 1024-byte blocks for disk usage\n\
 "), stdout);
       fputs (_("\
   -l                         use a long listing format\n\
-- 
1.7.7.6