It has always bothered me that linting manuals complained about missing
manuals from packages despite their path being part of the default
MANPATH:
No local man(1) config:
$ echo $MANPATH
ksh: MANPATH: parameter not set
$ cat /etc/man.conf
cat: /etc/man.conf: No such file or directory
man(1) finds tog(1), but mandoc(1) does not:
$ mandoc -T lint `man -w tog` | grep 'not found'
mandoc: /usr/local/man/man1/tog.1:35:6: STYLE: referenced manual not
found: Xr git-repository 5 (2 times)
mandoc: /usr/local/man/man1/tog.1:188:6: STYLE: referenced manual not
found: Xr got 1 (6 times)
Not having those STYLE "issues" also makes `mandoc -T lint' more useful
for automatic regression/pre-commit/etc. checks in ports using it since
even STYLE messages result in a non-zero exit status, i.e. `make test'
for a totally fine manual would fail.
Using `-W warning' to omit STYLE message entirely is undesired because
it silences other useful style hints as well and parsing output to work
around all this is hackish at best.
So let's lint manuals with the default MANPATH instead of the limited
base one.
Feedback? Objections? OK?
Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/main.c,v
retrieving revision 1.256
diff -u -p -r1.256 main.c
--- main.c 19 Feb 2021 19:49:49 -0000 1.256
+++ main.c 3 Apr 2021 00:29:56 -0000
@@ -962,7 +962,7 @@ check_xr(void)
size_t sz;
if (paths.sz == 0)
- manpath_base(&paths);
+ manpath_default(&paths);
for (xr = mandoc_xr_get(); xr != NULL; xr = xr->next) {
if (xr->line == -1)
Index: manconf.h
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/manconf.h,v
retrieving revision 1.9
diff -u -p -r1.9 manconf.h
--- manconf.h 21 Jul 2020 15:08:49 -0000 1.9
+++ manconf.h 3 Apr 2021 00:29:57 -0000
@@ -55,4 +55,4 @@ struct manconf {
void manconf_parse(struct manconf *, const char *, char *, char *);
int manconf_output(struct manoutput *, const char *, int);
void manconf_free(struct manconf *);
-void manpath_base(struct manpaths *);
+void manpath_default(struct manpaths *);
Index: manpath.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/manpath.c,v
retrieving revision 1.30
diff -u -p -r1.30 manpath.c
--- manpath.c 27 Aug 2020 14:59:42 -0000 1.30
+++ manpath.c 3 Apr 2021 00:30:46 -0000
@@ -93,10 +93,9 @@ manconf_parse(struct manconf *conf, cons
}
void
-manpath_base(struct manpaths *dirs)
+manpath_default(struct manpaths *dirs)
{
- char path_base[] = MANPATH_BASE;
- manpath_parseline(dirs, path_base, '\0');
+ manpath_parseline(dirs, MANPATH_DEFAULT, '\0');
}
/*