NetBSD Problem Report #42286

From www@NetBSD.org  Sun Nov  8 21:00:42 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 8877B63B906
	for <gnats-bugs@gnats.netbsd.org>; Sun,  8 Nov 2009 21:00:42 +0000 (UTC)
Message-Id: <20091108210042.5546663B8CD@www.NetBSD.org>
Date: Sun,  8 Nov 2009 21:00:42 +0000 (UTC)
From: bughunting@xs4all.nl
Reply-To: bughunting@xs4all.nl
To: gnats-bugs@NetBSD.org
Subject: Minor mistakes, and one supposed error, in test(1) manpage
X-Send-Pr-Version: www-1.0

>Number:         42286
>Category:       bin
>Synopsis:       Minor mistakes, and one supposed error, in test(1) manpage
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 08 21:05:01 +0000 2009
>Closed-Date:    Tue Nov 10 18:20:14 +0000 2009
>Last-Modified:  Tue Nov 10 18:35:00 +0000 2009
>Originator:     Bug Hunting
>Release:        5.99.21
>Organization:
>Environment:
>Description:
The test(1) manpage contains some minor errors, namely, it doesn't
use nroff(1) macros on some locations where it should (or: could).

Also, although it is explicitly defined with `Ns' macros in the
manpage's nroff(1) source (and the manpage _does_ mention ``All
operators and flags are separate arguments to the test utility''),
showing no spacing after `(' and before `)' in the `(expression)' part
is very confusing, since those spaces are needed in shell.  Since it is
unclear to me why `Ns' macros are used here, i suggest removing them.
>How-To-Repeat:
"man 1 test".



test(1) usage with parentheses:

$ /bin/test '('a = a')' && echo true || echo false # incorrect usage
false
$ /bin/test '(' a = a ')' && echo true || echo false # correct usage
true
>Fix:
Apply the following patch:

$ cvs diff -u bin/test/test.1
Index: bin/test/test.1
===================================================================
RCS file: /cvsroot/src/bin/test/test.1,v
retrieving revision 1.26
diff -u -r1.26 test.1
--- bin/test/test.1     6 May 2009 08:26:43 -0000       1.26
+++ bin/test/test.1     8 Nov 2009 20:57:15 -0000
@@ -32,7 +32,7 @@
 .\"
 .\"     @(#)test.1     8.1 (Berkeley) 5/31/93
 .\"
-.Dd May 5, 2009
+.Dd November 8, 2009
 .Dt TEST 1
 .Os
 .Sh NAME
@@ -47,17 +47,24 @@
 .Sh DESCRIPTION
 The
 .Nm test
-utility evaluates the expression and, if it evaluates
+utility evaluates
+.Ar expression
+and, if it evaluates
 to true, returns a zero (true) exit status; otherwise
 it returns 1 (false).
-If there is no expression, test also
+If
+.Ar expression
+is not given,
+.Nm test
+also
 returns 1 (false).
 .Pp
 All operators and flags are separate arguments to the
 .Nm test
 utility.
 .Pp
-The following primaries are used to construct expression:
+The following primaries are used to construct
+.Ar expression :
 .Bl -tag -width Ar
 .It Fl b Ar file
 True if
@@ -269,8 +276,10 @@
 or
 .Ar expression2
 are true.
-.It Cm \&( Ns Ar expression Ns Cm \&)
-True if expression is true.
+.It Cm \&( Ar expression Cm \&)
+True if
+.Ar expression
+is true.
 .El
 .Pp
 The
@@ -300,10 +309,11 @@
 utility exits with one of the following values:
 .Bl -tag -width Ds
 .It 0
-expression evaluated to true.
+.Ar expression
+evaluated to true.
 .It 1
-expression evaluated to false or expression was
-missing.
+.Ar expression
+evaluated to false or was missing.
 .It \*[Gt]1
 An error occurred.
 .El

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Tue, 10 Nov 2009 18:20:14 +0000
State-Changed-Why:
Committed, thank you!


From: Thomas Klausner <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/42286 CVS commit: src/bin/test
Date: Tue, 10 Nov 2009 18:19:46 +0000

 Module Name:	src
 Committed By:	wiz
 Date:		Tue Nov 10 18:19:46 UTC 2009

 Modified Files:
 	src/bin/test: test.1

 Log Message:
 Correct usage for parentheses, and mark up "expression" in more places.

 From Bug Hunting in PR 42286.


 To generate a diff of this commit:
 cvs rdiff -u -r1.26 -r1.27 src/bin/test/test.1

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.