GNU bug report logs - #6383
cat has misleading documentation

Previous Next

Package: coreutils;

Reported by: "Chas. Owens" <chas.owens <at> gmail.com>

Date: Wed, 9 Jun 2010 14:31:02 UTC

Severity: normal

Fixed in version 8.6

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eric Blake <eblake <at> redhat.com>
To: 6383 <at> debbugs.gnu.org
Cc: chas.owens <at> gmail.com
Subject: bug#6383: [PATCH] cat: improve documentation
Date: Wed,  9 Jun 2010 11:17:12 -0600
* src/cat.c (usage): Clarify that -b overrides -n.
* doc/coreutils.texi (cat invocation): Likewise.
* THANKS: Update.
Suggested by Chas. Owens, in bug 6383.
---

> The -n option is documented as "number all output lines", but when -b
> is present it only numbers non-blank lines.  The documentation should
> read "number output lines".

Thanks for the report.  -b in isolation also numbers lines; so it is
more an issue that -b overrides -n.  How about this patch, instead?

 THANKS             |    1 +
 doc/coreutils.texi |    3 ++-
 src/cat.c          |    2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/THANKS b/THANKS
index dce3c94..caa40de 100644
--- a/THANKS
+++ b/THANKS
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 26b4eba..b27d9d7 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -1494,7 +1494,8 @@ cat invocation
 @itemx --number
 @opindex -n
 @opindex --number
-Number all output lines, starting with 1.
+Number all output lines, starting with 1.  This option is ignored
+if @option{-b} is in effect.

 @item -s
 @itemx --squeeze-blank
diff --git a/src/cat.c b/src/cat.c
index eebfb97..c4a2a9e 100644
--- a/src/cat.c
+++ b/src/cat.c
@@ -92,7 +92,7 @@ Usage: %s [OPTION]... [FILE]...\n\
 Concatenate FILE(s), or standard input, to standard output.\n\
 \n\
   -A, --show-all           equivalent to -vET\n\
-  -b, --number-nonblank    number nonempty output lines\n\
+  -b, --number-nonblank    number nonempty output lines, overrides -n\n\
   -e                       equivalent to -vE\n\
   -E, --show-ends          display $ at end of each line\n\
   -n, --number             number all output lines\n\
-- 
1.7.0.1





This bug report was last modified 15 years and 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.