NetBSD Problem Report #47392
From www@NetBSD.org Wed Jan 2 17:06:58 2013
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 B9E7363EBAF
for <gnats-bugs@gnats.NetBSD.org>; Wed, 2 Jan 2013 17:06:57 +0000 (UTC)
Message-Id: <20130102170626.576A163EBAF@www.NetBSD.org>
Date: Wed, 2 Jan 2013 17:06:26 +0000 (UTC)
From: er.abhinav.upadhyay@gmail.com
Reply-To: er.abhinav.upadhyay@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Fix a comment in makemandb.c to reflect reality
X-Send-Pr-Version: www-1.0
>Number: 47392
>Category: bin
>Synopsis: Fix a comment in makemandb.c to reflect reality
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Jan 02 17:10:00 +0000 2013
>Closed-Date: Tue Apr 07 17:48:46 +0000 2015
>Last-Modified: Tue Apr 07 17:50:01 +0000 2015
>Originator: Abhinav Upadhyay
>Release: NetBSD-current
>Organization:
>Environment:
NetBSD 6.99.15 NetBSD 6.99.15 (GENERIC) #0: Fri Nov 30 23:27:05 UTC 2012 builds@b6.netbsd.org:/home/builds/ab/HEAD/i386/201211301540Z-obj/home/builds/ab/HEAD/src/sys/arch/i386/compile/GENERIC i386
>Description:
The comment in makemandb.c at line 943 does not hold true anymore, it is out of sync. It should be removed.
>How-To-Repeat:
>Fix:
Index: makemandb.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/makemandb/makemandb.c,v
retrieving revision 1.16
diff -u -r1.16 makemandb.c
--- makemandb.c 8 Nov 2012 19:17:54 -0000 1.16
+++ makemandb.c 2 Jan 2013 17:02:18 -0000
@@ -75,7 +75,7 @@
secbuff errors; // ERRORS
char section[2];
- int xr_found;
+ int xr_found; // To track whether a .Xr was seen when parsing a section
/* Fields for mandb_meta table */
char *md5_hash;
@@ -940,10 +940,6 @@
static void
pmdoc_Nd(const struct mdoc_node *n, mandb_rec *rec)
{
- /*
- * A static variable for keeping track of whether a Xr macro was seen
- * previously.
- */
char *buf = NULL;
char *temp;
>Release-Note:
>Audit-Trail:
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/47392: Fix a comment in makemandb.c to reflect reality
Date: Fri, 4 Jan 2013 10:05:06 +0000
(please send PR traffic to gnats-bugs)
------
From: Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>
To: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/47392: Fix a comment in makemandb.c to reflect reality
Date: Thu, 3 Jan 2013 01:48:47 +0530
On Wed, Jan 02, 2013 at 05:10:00PM +0000, er.abhinav.upadhyay@gmail.com wrote:
> >Number: 47392
> >Category: bin
> >Synopsis: Fix a comment in makemandb.c to reflect reality
> >Confidential: no
> >Severity: non-critical
> >Priority: low
> >Responsible: bin-bug-people
> >State: open
> >Class: sw-bug
> >Submitter-Id: net
> >Arrival-Date: Wed Jan 02 17:10:00 +0000 2013
> >Originator: Abhinav Upadhyay
> >Release: NetBSD-current
> >Organization:
> >Environment:
> NetBSD 6.99.15 NetBSD 6.99.15 (GENERIC) #0: Fri Nov 30 23:27:05 UTC 2012 builds@b6.netbsd.org:/home/builds/ab/HEAD/i386/201211301540Z-obj/home/builds/ab/HEAD/src/sys/arch/i386/compile/GENERIC i386
> >Description:
> The comment in makemandb.c at line 943 does not hold true anymore, it is out of sync. It should be removed.
> >How-To-Repeat:
>
> >Fix:
> Index: makemandb.c
> ===================================================================
> RCS file: /cvsroot/src/usr.sbin/makemandb/makemandb.c,v
> retrieving revision 1.16
> diff -u -r1.16 makemandb.c
> --- makemandb.c 8 Nov 2012 19:17:54 -0000 1.16
> +++ makemandb.c 2 Jan 2013 17:02:18 -0000
> @@ -75,7 +75,7 @@
> secbuff errors; // ERRORS
> char section[2];
>
> - int xr_found;
> + int xr_found; // To track whether a .Xr was seen when parsing a section
>
> /* Fields for mandb_meta table */
> char *md5_hash;
> @@ -940,10 +940,6 @@
> static void
> pmdoc_Nd(const struct mdoc_node *n, mandb_rec *rec)
> {
> - /*
> - * A static variable for keeping track of whether a Xr macro was seen
> - * previously.
> - */
> char *buf = NULL;
> char *temp;
>
>
Please apply the attached patch, which changes a couple of variable
names for better readability.
Index: makemandb.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/makemandb/makemandb.c,v
retrieving revision 1.16
diff -u -r1.16 makemandb.c
--- makemandb.c 8 Nov 2012 19:17:54 -0000 1.16
+++ makemandb.c 2 Jan 2013 20:01:56 -0000
@@ -75,7 +75,7 @@
secbuff errors; // ERRORS
char section[2];
- int xr_found;
+ int xr_found; // To track whether a .Xr was seen when parsing a section
/* Fields for mandb_meta table */
char *md5_hash;
@@ -940,12 +940,9 @@
static void
pmdoc_Nd(const struct mdoc_node *n, mandb_rec *rec)
{
- /*
- * A static variable for keeping track of whether a Xr macro was seen
- * previously.
- */
char *buf = NULL;
- char *temp;
+ char *name;
+ char *section;
if (n == NULL)
return;
@@ -956,12 +953,14 @@
* An Xr macro was seen previously, so parse this
* and the next node.
*/
- temp = estrdup(n->string);
+ name = estrdup(n->string);
n = n->next;
- easprintf(&buf, "%s(%s)", temp, n->string);
+ assert(n->type == MDOC_TEXT);
+ section = n->string;
+ easprintf(&buf, "%s(%s)", name, section);
concat(&rec->name_desc, buf);
free(buf);
- free(temp);
+ free(name);
} else {
concat(&rec->name_desc, n->string);
}
State-Changed-From-To: open->closed
State-Changed-By: plunky@NetBSD.org
State-Changed-When: Tue, 07 Apr 2015 17:48:46 +0000
State-Changed-Why:
applied patch (largely), thanks!
From: "Iain Hibbert" <plunky@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47392 CVS commit: src/usr.sbin/makemandb
Date: Tue, 7 Apr 2015 17:47:10 +0000
Module Name: src
Committed By: plunky
Date: Tue Apr 7 17:47:10 UTC 2015
Modified Files:
src/usr.sbin/makemandb: makemandb.c
Log Message:
largely apply patch from PR bin/47392 by Abhinav Upadhyay
change some comments to reflect reality, a variable name to enhance
readability, and adds an assert for safety.
To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 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.
>Unformatted:
(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-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.