Hello,
as reported in rh bz#446294 , ls is not very clear with it's exit status
documentation. This patch should clarify it a bit.

Greetings,
         Ondřej Vašík
From a3ef5a58f396b53287d7870d2cf35198789240cf Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= <[EMAIL PROTECTED]>
Date: Thu, 9 Oct 2008 10:56:54 +0200
Subject: [PATCH] ls: clarify exit status of command

ls.c (exit_status): clarify comments of exit statuses
     (usage): specify what is minor and serious trouble
coreutils.texi (ls invocation): clarify exit status documentation
---
 doc/coreutils.texi |    6 ++++--
 src/ls.c           |   12 +++++++++---
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 11b9ab9..e0b0249 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -6070,8 +6070,10 @@ 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., a subdirectory not mentioned in command line
+  argument was not found)
+2 serious trouble (e.g., memory exhausted, invalid option or could
+  not find file or directory specified in command line argument)
 @end display
 
 Also see @ref{Common options}.
diff --git a/src/ls.c b/src/ls.c
index e107162..3d0550a 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -716,10 +716,11 @@ static int exit_status;
 enum
   {
     /* "ls" had a minor problem (e.g., it could not stat a directory
-       entry).  */
+       entry not mentioned in command line argument).  */
     LS_MINOR_PROBLEM = 1,
 
-    /* "ls" had more serious trouble.  */
+    /* "ls" had more serious trouble (e.g., memory exhausted, invalid
+       option or could not stat an entry from command line argument.  */
     LS_FAILURE = 2
   };
 
@@ -4527,7 +4528,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,
+1 if minor problems(e.g., a subdirectory not mentioned in command line\n\
+  argument was not found),\n\
+2 if serious trouble(e.g., memory exhausted, invalid option or could\n\
+  not find file or directory specified in command line argument).\n\
 "), stdout);
       emit_bug_reporting_address ();
     }
-- 
1.5.6.1.156.ge903b

Attachment: signature.asc
Description: Toto je digitálně podepsaná část zprávy

_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to