From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: When the content of a manual page does not specify a section,
Date: Wed, 17 Aug 2016 15:47:26 -0500 (EST) [thread overview]
Message-ID: <14452167783808667661.enqueue@fantadrom.bsd.lv> (raw)
Log Message:
-----------
When the content of a manual page does not specify a section, the
empty string got added to the list of sections, breaking the database
format slightly and causing the page to not be considered part of
any section, not even if a section could be deduced from the directory
or from the file name.
Bug found due to the bogus pcredemo(3) "manual" in the pcre-8.38p0 package.
Modified Files:
--------------
mdocml:
dba.c
dba.h
dba_read.c
mandocdb.c
Revision Data
-------------
Index: dba.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/dba.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -Ldba.c -Ldba.c -u -p -r1.7 -r1.8
--- dba.c
+++ dba.c
@@ -136,18 +136,15 @@ dba_write(const char *fname, struct dba
* Create a new page and append it to the pages table.
*/
struct dba_array *
-dba_page_new(struct dba_array *pages, const char *name, const char *sect,
- const char *arch, const char *desc, const char *file, enum form form)
+dba_page_new(struct dba_array *pages, const char *arch,
+ const char *desc, const char *file, enum form form)
{
struct dba_array *page, *entry;
page = dba_array_new(DBP_MAX, 0);
entry = dba_array_new(1, DBA_STR | DBA_GROW);
- if (name != NULL)
- dba_array_add(entry, prepend(name, NAME_FILE & NAME_MASK));
dba_array_add(page, entry);
entry = dba_array_new(1, DBA_STR | DBA_GROW);
- dba_array_add(entry, (void *)sect);
dba_array_add(page, entry);
if (arch != NULL && *arch != '\0') {
entry = dba_array_new(1, DBA_STR | DBA_GROW);
Index: mandocdb.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandocdb.c,v
retrieving revision 1.226
retrieving revision 1.227
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.226 -r1.227
--- mandocdb.c
+++ mandocdb.c
@@ -2013,11 +2013,12 @@ dbadd(struct dba *dba, struct mpage *mpa
cp = mpage->desc;
i = strlen(cp);
mustfree = render_string(&cp, &i);
- mpage->dba = dba_page_new(dba->pages, mlink->name, mpage->sec,
+ mpage->dba = dba_page_new(dba->pages,
*mpage->arch == '\0' ? mlink->arch : mpage->arch,
cp, mlink->file, mpage->form);
if (mustfree)
free(cp);
+ dba_page_add(mpage->dba, DBP_SECT, mpage->sec);
while (mlink != NULL) {
dbadd_mlink(mlink);
Index: dba.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/dba.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -Ldba.h -Ldba.h -u -p -r1.1 -r1.2
--- dba.h
+++ dba.h
@@ -40,8 +40,7 @@ struct dba *dba_read(const char *);
int dba_write(const char *, struct dba *);
struct dba_array *dba_page_new(struct dba_array *, const char *,
- const char *, const char *, const char *,
- const char *, enum form);
+ const char *, const char *, enum form);
void dba_page_add(struct dba_array *, int32_t, const char *);
void dba_page_alias(struct dba_array *, const char *, uint64_t);
Index: dba_read.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/dba_read.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -Ldba_read.c -Ldba_read.c -u -p -r1.3 -r1.4
--- dba_read.c
+++ dba_read.c
@@ -48,12 +48,11 @@ dba_read(const char *fname)
dba = dba_new(npages < 128 ? 128 : npages);
for (ip = 0; ip < npages; ip++) {
pdata = dbm_page_get(ip);
- page = dba_page_new(dba->pages, NULL, pdata->sect,
- pdata->arch, pdata->desc, pdata->file + 1, *pdata->file);
+ page = dba_page_new(dba->pages, pdata->arch,
+ pdata->desc, pdata->file + 1, *pdata->file);
for (cp = pdata->name; *cp != '\0'; cp = strchr(cp, '\0') + 1)
dba_page_add(page, DBP_NAME, cp);
- cp = pdata->sect;
- while (*(cp = strchr(cp, '\0') + 1) != '\0')
+ for (cp = pdata->sect; *cp != '\0'; cp = strchr(cp, '\0') + 1)
dba_page_add(page, DBP_SECT, cp);
if ((cp = pdata->arch) != NULL)
while (*(cp = strchr(cp, '\0') + 1) != '\0')
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2016-08-17 20:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=14452167783808667661.enqueue@fantadrom.bsd.lv \
--to=schwarze@mdocml.bsd.lv \
--cc=source@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).