doc: ls: clarify exit status description
authorOndřej Vašík <ovasik@redhat.com>
Thu, 9 Oct 2008 08:56:54 +0000 (10:56 +0200)
committerJim Meyering <meyering@redhat.com>
Mon, 13 Oct 2008 07:01:54 +0000 (09:01 +0200)
* src/ls.c (exit_status): Clarify comments.
(usage): Clarify exit status description in --help output.
* doc/coreutils.texi (ls invocation): Clarify exit status documentation
Reported by Greg Metcalfe in <http://bugzilla.redhat.com/446294>.

THANKS
doc/coreutils.texi
src/ls.c

diff --git a/THANKS b/THANKS
index e6e48b3..d06f755 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -201,6 +201,7 @@ Guochun Shi                         gshi@ncsa.uiuc.edu
 GOTO Masanori                       gotom@debian.or.jp
 Greg Louis                          glouis@dynamicro.on.ca
 Greg McGary                         gkm@gnu.org
+Greg Metcalfe                       metcalfegreg@qwest.net
 Greg Schafer                        gschafer@zip.com.au
 Greg Troxel                         gdt@bbn.com
 Greg Wooledge                       gawooledge@sherwin.com
index a0d2202..b7e044d 100644 (file)
@@ -6073,8 +6073,11 @@ Exit status:
 
 @display
 0 success
-1 minor problems (e.g., a subdirectory was not found)
-2 serious trouble (e.g., memory exhausted)
+1 minor problems  (e.g., failure to access a file or directory not
+  specified as a command line argument.  This happens when listing a
+  directory in which entries are actively being removed or renamed.)
+2 serious trouble (e.g., memory exhausted, invalid option or failure
+  to access file or directory specified as a command line argument)
 @end display
 
 Also see @ref{Common options}.
index e107162..ad33acc 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -715,11 +715,14 @@ static int exit_status;
 /* Exit statuses.  */
 enum
   {
-    /* "ls" had a minor problem (e.g., it could not stat a directory
-       entry).  */
+    /* "ls" had a minor problem.  E.g., while processing a directory,
+       ls obtained the name of an entry via readdir, yet was later
+       unable to stat that name.  This happens when listing a directory
+       in which entries are actively being removed or renamed.  */
     LS_MINOR_PROBLEM = 1,
 
-    /* "ls" had more serious trouble.  */
+    /* "ls" had more serious trouble (e.g., memory exhausted, invalid
+       option or failure to stat a command line argument.  */
     LS_FAILURE = 2
   };
 
@@ -4527,7 +4530,12 @@ colors, and can be set easily by the dircolors command.\n\
 "), stdout);
       fputs (_("\
 \n\
-Exit status is 0 if OK, 1 if minor problems, 2 if serious trouble.\n\
+Exit status:\n\
+0 if OK,\n\
+1 if minor problems (e.g., failure to access a file or directory not\n\
+  specified as a command line argument\n\
+2 if serious trouble (e.g., memory exhausted, invalid option or failure\n\
+  to access a file or directory specified as a command line argument).\n\
 "), stdout);
       emit_bug_reporting_address ();
     }