]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
ls: fix possible incorrect exit status when recursing directories
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Thu, 5 Sep 2013 01:17:56 +0000 (02:17 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 5 Sep 2013 01:50:11 +0000 (02:50 +0100)
If there is an error reading a directory that was referenced
through recursion, rather than directly on the command line,
then exit with the "less serious" exit code, rather than the
"serious" exit code reserved for command line arguments.
This issue was introduced in commit v5.2.1-1908-gb58dea5

* src/ls.c (print_dir): Ensure that the command_line_arg param
is false for directories being recursed into.
* NEWS: Mention the bug fix.
Fixes http://bugs.gnu.org/15249

NEWS
src/ls.c

diff --git a/NEWS b/NEWS
index 4a78617c7b18c52e657f6d716e2f9afe594a689a..d26722ddfbdadf78a42bf69d4f808fe5a0e0acef 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,10 @@ GNU coreutils NEWS                                    -*- outline -*-
   the relative link on the dereferenced path of an existing link.
   [This bug was introduced when --relative was added in coreutils-8.16.]
 
+  ls --recursive will no longer exit with "serious" exit code (2), if there
+  is an error reading a directory not specified on the command line.
+  [Bug introduced in coreutils-5.3.0]
+
   mkdir, mkfifo, and mknod now work better when creating a file in a directory
   with a default ACL whose umask disagrees with the process's umask, on a
   system such as GNU/Linux where directory ACL umasks override process umasks.
index 1652bcf94314c29e8444bfe9a6fe250e1ec0846e..512d65e2dd0f998726b6ecb610088f25b5ba112d 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -2647,7 +2647,7 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
      contents listed rather than being mentioned here as files.  */
 
   if (recursive)
-    extract_dirs_from_files (name, command_line_arg);
+    extract_dirs_from_files (name, false);
 
   if (format == long_format || print_block_size)
     {