summaryrefslogtreecommitdiff
path: root/system/mandoc/cgi-search.patch
diff options
context:
space:
mode:
authorMax Rees <maxcrees@me.com>2020-06-05 16:45:20 -0500
committerMax Rees <maxcrees@me.com>2020-06-12 19:07:10 -0500
commit550361815d6a1cf261e99ad2b430433ef6966e1a (patch)
treee1a44528172acab832067997083e95fc74f8f79c /system/mandoc/cgi-search.patch
parent4e53c51f591cbd62817c797c10d240c008182ab3 (diff)
downloadpackages-550361815d6a1cf261e99ad2b430433ef6966e1a.tar.gz
packages-550361815d6a1cf261e99ad2b430433ef6966e1a.tar.bz2
packages-550361815d6a1cf261e99ad2b430433ef6966e1a.tar.xz
packages-550361815d6a1cf261e99ad2b430433ef6966e1a.zip
system/mandoc: new package
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=\"/");