[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: broken ls in coreutils 8.25

From: Harald Dunkel
Subject: Re: broken ls in coreutils 8.25
Date: Tue, 2 Feb 2016 07:17:19 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:44.0) Gecko/20100101 Thunderbird/44.0

Hash: SHA256

Hi Pádraig,

On 02/01/16 17:07, Pádraig Brady wrote:
> On 31/01/16 06:48, Harald Dunkel wrote:
> The reasons we changed the default was:
> - It only happens when outputting to terminals

This means if you use "ls -1 | somescript" the script will
not see the quoting style. Don't you think that this is
inconsistent, not to mention that a script would benefit
much more from this quoting style than a human?

> - It disambiguates the output for users

This means that the user has to count '\' and "'" in the output
of ls to get the "real" filename.

> - Output can be pasted back in the shell for further processing

This means that it useful only on a graphic terminal, for people
using a mouse, but it affects all users using "ls"

> - Users can get back to the old format by adding -N to their ls alias

Or they can use busybox, Solaris, AIX, HP-UX and tons of others.

> I see some disadvantages as:
> - Slightly misaligns -l output when some files have spaces

I cannot express *how* annoying this is, e.g. if you are using
"ls -al" looking for a file or directory. The output appears to
be completely messed up, since the "." and "'" at the beginning
of a file name are very hard to distinguish, esp. in a long
listing. It appears to be unsorted. Artificial sample:

% export LANG=en_US.UTF-8
% ls -al
total 164
drwxrwxrwt 13 root  root    4096 Feb  2 06:55 .
drwxr-xr-x 43 root  root    4096 Jan 14 12:34 ..
- -rw-r--r--  1 harri harri      0 Feb  2 06:55 a
- -rw-r--r--  1 harri harri      0 Feb  2 06:55 .a
- -rw-r--r--  1 harri harri      0 Feb  2 06:55 '.a b'
- -rw-r--r--  1 harri harri      0 Feb  2 06:55 .a.b
- -rw-r--r--  1 harri harri      0 Feb  2 06:55 '.a'\''b'
- -rw-r--r--  1 harri harri      0 Feb  2 06:55 'a b'
- -rw-r--r--  1 harri harri      0 Feb  2 06:55 a.b
- -rw-r--r--  1 harri harri      0 Feb  2 06:55 'a'\''b'

> - Produces longer output for file names with single quotes

This means that some file names appear to have a different length,
but they don't.

> So that's 2 functional advantages over 2 aesthetic disadvantages. Given the 
> advantages especially for new users and the complications of producing shell 
> quoted file names oneself, we chose the new default.

Sorry, but I don't see the functional advantage, since the
new quoting style is not used if you are using a pipe.
You get it only on terminal, writing directly to the user.

The "aesthetic disadvantage" exists and is underestimated here,
since the main purpose of ls is to produce readable output. Now
the user needs some integrated quoting filter to translate the
shown directory elements back to their real names. I doubt that
new users will benefit from this.

Don't get me wrong, I have no problem with the new quoting style.
I don't see the advantage of making it the default.


Version: GnuPG v2


reply via email to

[Prev in Thread] Current Thread [Next in Thread]