]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
ls: default to --quoting=shell-escape for output to terminal
authorPádraig Brady <P@draigBrady.com>
Tue, 3 Nov 2015 16:32:08 +0000 (16:32 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 4 Nov 2015 23:30:15 +0000 (23:30 +0000)
* src/ls.c (decode_switches): Set "shell-escape" if isatty().
* doc/coreutils.texi (ls invocation): Update the defaults description.
* NEWS: Mention the change in behavior.  It should not have
backwards compat issues, but mentioning here just in case.

NEWS
doc/coreutils.texi
src/ls.c

diff --git a/NEWS b/NEWS
index 38b466465704ca931a6a865674faa9c777d2d155..08cb1388fa6034400d2d5b4f46a805762709697c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,9 @@ GNU coreutils NEWS                                    -*- outline -*-
   df now prefers sources towards the root of a device when
   eliding duplicate bind mounted entries.
 
+  ls now quotes file names unambiguously and appropriate for use in a shell,
+  when outputting to a terminal.
+
 ** Improvements
 
   All utilities now quote user supplied arguments in error strings,
index 8618a645739b0fb40dd3bc3fc83649506c1be76f..8034807a4ecfddf14615eb9eda0225385e355f65 100644 (file)
@@ -7704,8 +7704,8 @@ this"} in the default C locale.  This looks nicer on many displays.
 
 You can specify the default value of the @option{--quoting-style} option
 with the environment variable @env{QUOTING_STYLE}@.  If that environment
-variable is not set, the default value is @samp{literal}, but this
-default may change to @samp{shell} in a future version of this package.
+variable is not set, the default value is @samp{shell-escape} when the
+output is a terminal, and @samp{literal} otherwise.
 
 @item --show-control-chars
 @opindex --show-control-chars
index c22c536c04731ff25c9cb265c2e8e7952381f4ad..2ae548d996b236660c6cea10293a31c674c21f01 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -1581,6 +1581,7 @@ decode_switches (int argc, char **argv)
       if (isatty (STDOUT_FILENO))
         {
           format = many_per_line;
+          set_quoting_style (NULL, shell_escape_quoting_style);
           /* See description of qmark_funny_chars, above.  */
           qmark_funny_chars = true;
         }