summaryrefslogtreecommitdiff
path: root/system/mandoc/cgi-search.patch
diff options
context:
space:
mode:
authorA. Wilcox <awilcox@wilcox-tech.com>2020-06-15 21:01:43 +0000
committerA. Wilcox <awilcox@wilcox-tech.com>2020-06-15 21:01:43 +0000
commit00232199464eaa13cd475988b17886a7635e8758 (patch)
tree07022c77daeabfcd5cb9756075265db3e2f204c5 /system/mandoc/cgi-search.patch
parent5e30a49b7a4cd903d446302f3a7f4ac685b53f2d (diff)
parentabe028b0d7927e92ab1dda0920a70955ef839be4 (diff)
downloadpackages-00232199464eaa13cd475988b17886a7635e8758.tar.gz
packages-00232199464eaa13cd475988b17886a7635e8758.tar.bz2
packages-00232199464eaa13cd475988b17886a7635e8758.tar.xz
packages-00232199464eaa13cd475988b17886a7635e8758.zip
Merge branch 'new/mandoc' into 'master'
Switch from man-db to mandoc See merge request adelie/packages!458
Diffstat (limited to 'system/mandoc/cgi-search.patch')
-rw-r--r--system/mandoc/cgi-search.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/system/mandoc/cgi-search.patch b/system/mandoc/cgi-search.patch
new file mode 100644
index 000000000..dd74be9ef
--- /dev/null
+++ b/system/mandoc/cgi-search.patch
@@ -0,0 +1,48 @@
+Don't exit immediately if mansearch returns some paths that man.cgi
+considers invalid, in particular translated manpages (e.g.
+./de/man1/chfn.1). Just mark them as invalid (section 10, see struct
+manpage in mansearch.h) and skip them later.
+
+--- mandoc-1.14.5/cgi.c 2019-03-10 04:56:43.000000000 -0500
++++ mandoc-1.14.5/cgi.c 2020-06-05 15:54:05.681060852 -0500
+@@ -605,13 +602,20 @@ pg_searchres(const struct req *req, stru
+ size_t i, iuse;
+ int archprio, archpriouse;
+ int prio, priouse;
++ int results = 0;
+
+ for (i = 0; i < sz; i++) {
+- if (validate_filename(r[i].file))
++ if (validate_filename(r[i].file)) {
++ results = 1;
+ continue;
++ }
+ warnx("invalid filename %s in %s database",
+ r[i].file, req->q.manpath);
+- pg_error_internal();
++ r[i].sec = 10;
++ }
++
++ if (! results) {
++ pg_noresult(req, "No results found.");
+ return;
+ }
+
+@@ -642,6 +646,8 @@ pg_searchres(const struct req *req, stru
+ priouse = 20;
+ archpriouse = 3;
+ for (i = 0; i < sz; i++) {
++ if (r[i].sec == 10)
++ continue;
+ sec = r[i].file;
+ sec += strcspn(sec, "123456789");
+ if (sec[0] == '\0')
+@@ -681,6 +687,8 @@ pg_searchres(const struct req *req, stru
+ if (sz > 1) {
+ puts("<table class=\"results\">");
+ for (i = 0; i < sz; i++) {
++ if (r[i].sec == 10)
++ continue;
+ printf(" <tr>\n"
+ " <td>"
+ "<a class=\"Xr\" href=\"/");