NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/46408: Inconsistent handling of hyphens by apropos(1)



>Number:         46408
>Category:       bin
>Synopsis:       Inconsistent handling of hyphens by apropos(1)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 04 08:35:00 +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;
                        }



Home | Main Index | Thread Index | Old Index