Subject: bug#41075: Changes to 'ls' output

From: Pádraig Brady <[email-masked]>
Date: Mon, 4 May 2020 16:14:20 +0100

tag 41075 notabug
close 41075
stop

On 04/05/2020 10:43, Chris Elvidge wrote:
> I have noticed that the output of ls seems to have changed from v8.25 to
> v8.32 where there is an apostrophe in the filename (sometimes); change
> from " surrounding to ' surrounding and '\'' replacing '. When output is
> piped through xxd, it is the same in both versions. I have 8.32
> installed in ~/bin/. Any ideas?

This is due to new quoting functionality which is discussed at:
https://www.gnu.org/software/coreutils/quotes.html

As to your particular observation,
when there are only single quotes, then we'll change
to using double quotes to simplify the quoting.
Once there are other problematic characters,
we switch to quoting with single quotes,
as shown in these examples:

   $ ls -1
   "just'single"
   'single'\''and(brackets)'

Note quoting is disabled when output is not to a terminal.

   $ ls -1 | cat
   just'single
   single'and(brackets)

You can disable this quoting behavior if you prefer, by adding '-N' to your ls alias.

thanks,
Pádraig