Subject: bug#24926: ls output has been made ugly

From: Eric Blake <[email-masked]>
Date: Fri, 11 Nov 2016 14:00:23 -0600

On 11/11/2016 12:26 PM, Paul Eggert wrote:
> Michael Schwager wrote:
>> Don't you think I can see the spaces in my filenames?
> 
> Not in general, no.  For example:
> 
> $ ls --quoting-style=literal
> a  b  c
> $ ls
> 'a  b'  c
> 
> That being said, perhaps 'ls' could quote less aggressively.  If 'ls'
> always arranges for at least two spaces between file names, for example,
> 'ls' doesn't need to quote a name merely because it contains a space
> surrounded by non-whitespace characters.  Come to think of it, 'ls -l'
> need not quote file names containing spaces at all.

If the idea is that the quoting is there to make copy-and-pasting into a
shell command line easier, then there is nothing we can do that is less
aggressive, since failing to quote spaces changes what the shell will
do.  If the idea is that the quoting should only be added to avoid
ambiguous situations, then maybe you are right that we can add further
heuristics to the quoting algorithm to disable quotes on output that is
unambiguous, even if it can't be pasted back into the shell.  Having two
different quoting modes, where you can choose between the options, may
be the way to go - but then you STILL have the problem of what to pick
as the default of those two modes when neither one was explicitly requested.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org