NetBSD Problem Report #46408

From www@NetBSD.org  Fri May  4 08:32:12 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 1A89A63B91F
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  4 May 2012 08:32:12 +0000 (UTC)
Message-Id: <20120504083211.3CB1F63B915@www.NetBSD.org>
Date: Fri,  4 May 2012 08:32:11 +0000 (UTC)
From: er.abhinav.upadhyay@gmail.com
Reply-To: er.abhinav.upadhyay@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Inconsistent handling of hyphens by apropos(1)
X-Send-Pr-Version: www-1.0

>Number:         46408
>Category:       bin
>Synopsis:       Inconsistent handling of hyphens by apropos(1)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 04 08:35:00 +0000 2012
>Closed-Date:    Mon May 07 21:18:21 +0000 2012
>Last-Modified:  Mon May 07 21:18:21 +0000 2012
>Originator:     Abhinav Upadhyay
>Release:        NetBSD 6.0_BETA
>Organization:
>Environment:
NetBSD  6.0_BETA NetBSD 6.0_BETA (GENERIC) i386                             
>Description:
The new apropos(1) incorrectly displays hyphens in the first line of the search results for a few man pages (for man(7) based man pages).

For example: 

$apropos gcc

gcc(1)         - GNU project C and C++ compiler

$apropos hash
nsec3hash(8)         - generate NSEC3 hash

The problem is being triggered because of a slight parsing bug in makemandb(8). Attached patch should fix it.

>How-To-Repeat:
$apropos gcc
$apropos hash

See hyphens in the first line of a few search results.


>Fix:
Index: makemandb.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/makemandb/makemandb.c,v
retrieving revision 1.7
diff -u -p -r1.7 makemandb.c
--- makemandb.c 2 Mar 2012 15:09:58 -0000       1.7
+++ makemandb.c 4 May 2012 08:18:29 -0000
@@ -1270,7 +1270,7 @@ pman_sh(const struct man_node *n, mandb_
                int has_alias = 0;      // Any more aliases left?
                while (*name_desc) {
                        /* Remove any leading spaces. */
-                       if (name_desc[0] == ' ') {
+                       if (name_desc[0] == ' ' || name_desc[0] =='-') {
                                name_desc++;
                                continue;
                        }

>Release-Note:

>Audit-Trail:
From: Thomas Klausner <wiz@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/46408: Inconsistent handling of hyphens by apropos(1)
Date: Fri, 4 May 2012 11:53:14 +0200

 On Fri, May 04, 2012 at 08:35:00AM +0000, er.abhinav.upadhyay@gmail.com wrote:
 > Index: makemandb.c
 > ===================================================================
 > RCS file: /cvsroot/src/usr.sbin/makemandb/makemandb.c,v
 > retrieving revision 1.7
 > diff -u -p -r1.7 makemandb.c
 > --- makemandb.c 2 Mar 2012 15:09:58 -0000       1.7
 > +++ makemandb.c 4 May 2012 08:18:29 -0000
 > @@ -1270,7 +1270,7 @@ pman_sh(const struct man_node *n, mandb_
 >                 int has_alias = 0;      // Any more aliases left?
 >                 while (*name_desc) {
 >                         /* Remove any leading spaces. */
 > -                       if (name_desc[0] == ' ') {
 > +                       if (name_desc[0] == ' ' || name_desc[0] =='-') {
 >                                 name_desc++;
 >                                 continue;
 >                         }
 > 

 The patch has whitespace problems. Also, can you please update the comment directly above?

 Thanks,
  Thomas

From: Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>
To: gnats-bugs@netbsd.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/46408: Inconsistent handling of hyphens by apropos(1)
Date: Fri, 4 May 2012 15:43:34 +0530

 On Fri, May 4, 2012 at 3:25 PM, Thomas Klausner <wiz@netbsd.org> wrote:
 > The following reply was made to PR bin/46408; it has been noted by GNATS.
 >
 > From: Thomas Klausner <wiz@NetBSD.org>
 > To: gnats-bugs@NetBSD.org
 > Cc:
 > Subject: Re: bin/46408: Inconsistent handling of hyphens by apropos(1)
 > Date: Fri, 4 May 2012 11:53:14 +0200
 >
 > =A0On Fri, May 04, 2012 at 08:35:00AM +0000, er.abhinav.upadhyay@gmail.co=
 m wrote:
 > =A0> Index: makemandb.c
 > =A0> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 > =A0> RCS file: /cvsroot/src/usr.sbin/makemandb/makemandb.c,v
 > =A0> retrieving revision 1.7
 > =A0> diff -u -p -r1.7 makemandb.c
 > =A0> --- makemandb.c 2 Mar 2012 15:09:58 -0000 =A0 =A0 =A0 1.7
 > =A0> +++ makemandb.c 4 May 2012 08:18:29 -0000
 > =A0> @@ -1270,7 +1270,7 @@ pman_sh(const struct man_node *n, mandb_
 > =A0> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int has_alias =3D 0; =A0 =A0 =A0// A=
 ny more aliases left?
 > =A0> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 while (*name_desc) {
 > =A0> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Remove any leadin=
 g spaces. */
 > =A0> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (name_desc[0] =3D=
 =3D ' ') {
 > =A0> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (name_desc[0] =3D=
 =3D ' ' || name_desc[0] =3D=3D'-') {
 > =A0> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 name=
 _desc++;
 > =A0> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 cont=
 inue;
 > =A0> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
 > =A0>
 >
 > =A0The patch has whitespace problems. Also, can you please update the com=
 ment directly above?
 >
 > =A0Thanks,
 > =A0Thomas
 >

 Index: makemandb.c
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /cvsroot/src/usr.sbin/makemandb/makemandb.c,v
 retrieving revision 1.7
 diff -u -p -r1.7 makemandb.c
 --- makemandb.c	2 Mar 2012 15:09:58 -0000	1.7
 +++ makemandb.c	4 May 2012 10:05:19 -0000
 @@ -1269,8 +1269,8 @@ pman_sh(const struct man_node *n, mandb_
  		 */
  		int has_alias =3D 0;	// Any more aliases left?
  		while (*name_desc) {
 -			/* Remove any leading spaces. */
 -			if (name_desc[0] =3D=3D ' ') {
 +			/* Remove any leading spaces or hyphens. */
 +			if (name_desc[0] =3D=3D ' ' || name_desc[0] =3D=3D'-') {
  				name_desc++;
  				continue;
  			}

State-Changed-From-To: open->feedback
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Fri, 04 May 2012 23:50:31 +0000
State-Changed-Why:
Committed. Do you want a pullup?


From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46408 CVS commit: src/usr.sbin/makemandb
Date: Fri, 4 May 2012 23:50:26 +0000

 Module Name:	src
 Committed By:	wiz
 Date:		Fri May  4 23:50:26 UTC 2012

 Modified Files:
 	src/usr.sbin/makemandb: makemandb.c

 Log Message:
 The new apropos(1) incorrectly displays hyphens in the first line
 of the search results for a few man pages (for man(7) based man
 pages).

 Use patch from Abhinav Upadhyay in PR 46408 to fix this.


 To generate a diff of this commit:
 cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/makemandb/makemandb.c

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

From: Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/46408 (Inconsistent handling of hyphens by apropos(1))
Date: Sat, 5 May 2012 10:54:24 +0530

 --14dae9340e3308ff8704bf43409e
 Content-Type: text/plain; charset=ISO-8859-1

 On May 5, 2012 5:20 AM, <wiz@netbsd.org> wrote:
 >
 > Synopsis: Inconsistent handling of hyphens by apropos(1)
 >
 > State-Changed-From-To: open->feedback
 > State-Changed-By: wiz@NetBSD.org
 > State-Changed-When: Fri, 04 May 2012 23:50:31 +0000
 > State-Changed-Why:
 > Committed. Do you want a pullup?

 Yes, please. That would be great. Thanks for committing.

 --14dae9340e3308ff8704bf43409e
 Content-Type: text/html; charset=ISO-8859-1

 <p><br>
 On May 5, 2012 5:20 AM, &lt;<a href="mailto:wiz@netbsd.org">wiz@netbsd.org</a>&gt; wrote:<br>
 &gt;<br>
 &gt; Synopsis: Inconsistent handling of hyphens by apropos(1)<br>
 &gt;<br>
 &gt; State-Changed-From-To: open-&gt;feedback<br>
 &gt; State-Changed-By: wiz@NetBSD.org<br>
 &gt; State-Changed-When: Fri, 04 May 2012 23:50:31 +0000<br>
 &gt; State-Changed-Why:<br>
 &gt; Committed. Do you want a pullup?</p>
 <p>Yes, please. That would be great. Thanks for committing.<br>
 </p>

 --14dae9340e3308ff8704bf43409e--

State-Changed-From-To: feedback->pending-pullups
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sun, 06 May 2012 10:22:37 +0000
State-Changed-Why:
#228


From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46408 CVS commit: [netbsd-6] src/usr.sbin/makemandb
Date: Mon, 7 May 2012 17:02:08 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Mon May  7 17:02:08 UTC 2012

 Modified Files:
 	src/usr.sbin/makemandb [netbsd-6]: makemandb.c

 Log Message:
 Pull up following revision(s) (requested by wiz in ticket #228):
 	usr.sbin/makemandb/makemandb.c: revision 1.8
 The new apropos(1) incorrectly displays hyphens in the first line
 of the search results for a few man pages (for man(7) based man
 pages).
 Use patch from Abhinav Upadhyay in PR 46408 to fix this.


 To generate a diff of this commit:
 cvs rdiff -u -r1.2.2.3 -r1.2.2.4 src/usr.sbin/makemandb/makemandb.c

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

State-Changed-From-To: pending-pullups->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Mon, 07 May 2012 21:18:21 +0000
State-Changed-Why:
pulled up, thanks.


>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.