From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5734 invoked from network); 5 Sep 2021 12:47:44 -0000 Received: from bsd.lv (HELO mandoc.bsd.lv) (66.111.2.12) by inbox.vuxu.org with ESMTPUTF8; 5 Sep 2021 12:47:44 -0000 Received: from fantadrom.bsd.lv (localhost [127.0.0.1]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id c9883d07 for ; Sun, 5 Sep 2021 07:47:41 -0500 (EST) Received: from scc-mailout-kit-02.scc.kit.edu (scc-mailout-kit-02.scc.kit.edu [129.13.231.82]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id 6cdbbbe9 for ; Sun, 5 Sep 2021 07:47:41 -0500 (EST) Received: from hekate.asta.kit.edu ([141.3.145.153] helo=hekate.usta.de) by scc-mailout-kit-02.scc.kit.edu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (envelope-from ) id 1mMrYh-0004Ue-QS; Sun, 05 Sep 2021 14:47:40 +0200 Received: from donnerwolke.asta.kit.edu ([141.3.145.61] helo=donnerwolke.usta.de) by hekate.usta.de with esmtp (Exim 4.92.2) (envelope-from ) id 1mMrYg-0002kl-Jy; Sun, 05 Sep 2021 14:47:38 +0200 Received: from athene.asta.kit.edu ([141.3.145.60] helo=athene.usta.de) by donnerwolke.usta.de with esmtp (Exim 4.84_2) (envelope-from ) id 1mMrYg-0008T7-En; Sun, 05 Sep 2021 14:47:38 +0200 Received: from localhost (athene.usta.de [local]) by athene.usta.de (OpenSMTPD) with ESMTPA id e0f2cdbc; Sun, 5 Sep 2021 14:47:38 +0200 (CEST) Date: Sun, 5 Sep 2021 14:47:38 +0200 From: Ingo Schwarze To: Soeren Tempel Cc: tech@mandoc.bsd.lv Subject: Re: Discrepancy in mansearch and fs_lookup behavior Message-ID: <20210905124738.GE98312@athene.usta.de> References: <1ZRQZL79I0W2O.3ILLDNAL4JXUP@8pit.net> <20210901203523.GB15706@athene.usta.de> <2E058N5M5N7IG.2Z5CUW18DPHPS@8pit.net> <20210904131832.GB61031@athene.usta.de> <20210904161632.GC61031@athene.usta.de> <3QJNXCTXZORDT.22DQHFTHANJXN@8pit.net> X-Mailinglist: mandoc-tech Reply-To: tech@mandoc.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3QJNXCTXZORDT.22DQHFTHANJXN@8pit.net> User-Agent: Mutt/1.12.2 (2019-09-21) Hi Soeren, Soeren Tempel wrote on Sat, Sep 04, 2021 at 07:51:58PM +0200: > Ingo Schwarze wrote: >> I believe the patch below fixes the issue that main() does not >> properly prioritize gzipped files according to their file name >> extensions. >> >> Does it make sense to you, and does it work for you? > Yes, the patch does make sense and it does work well for me: > > man 3 open -> Perl open(3pm) man page > man 3p open -> POSIX open(3p) man page > man 3pm open -> Perl open(3pm) man page > > Thanks a lot for fixing this so quickly! Thank you for reporting and testing! The patch is now committed, see the commit below. > BTW: Is there any chance that you could make a new release soonish? Has > been a while since the last release and CVS has accumulated quite a few > useful fixes since 1.14.5. Yes, the next release is long overdue. I have been paying attention to not do major reorganizations that might destabilize the code base for quite some time now. I'm trying to get those bugs fixed that are easy to fix with a low risk, then draft the release notes, then send out a beta to downstream maintainers for testing without too much additional delay. My list of pending patches is already free from mandoc entries. My list of urgent bug reports still contains one or two entries related to tbl(7). After that, a final pass over the TODO file makes sense, to see whether anything trivial remains in there - but the bulk of the TODO entries will certainly not be addressed before the upcoming release. Yours, Ingo Log Message: ----------- during prioritization for man(1), correctly extract the section name from the file name extension of gzipped manual page files; bug found on Alpine Linux by Soeren Tempel , who also tested this patch Modified Files: -------------- mandoc: main.c Revision Data ------------- Index: main.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/main.c,v retrieving revision 1.357 retrieving revision 1.358 diff -Lmain.c -Lmain.c -u -p -r1.357 -r1.358 --- main.c +++ main.c @@ -132,7 +132,7 @@ main(int argc, char *argv[]) struct mparse *mp; /* Opaque parser object. */ const char *conf_file; /* -C: alternate config file. */ const char *os_s; /* -I: Operating system for display. */ - const char *progname, *sec; + const char *progname, *sec, *ep; char *defpaths; /* -M: override manpaths. */ char *auxpaths; /* -m: additional manpaths. */ char *oarg; /* -O: output option string. */ @@ -536,11 +536,16 @@ main(int argc, char *argv[]) sec++; /* Prefer without suffix. */ if (*sec != '/') prio += 10; /* Wrong dir name. */ - if (search.sec != NULL && - (strlen(sec) <= ssz + 3 || - strcmp(sec + strlen(sec) - ssz, - search.sec) != 0)) - prio += 20; /* Wrong file ext. */ + if (search.sec != NULL) { + ep = strchr(sec, '\0'); + if (ep - sec > 3 && + strncmp(ep - 3, ".gz", 3) == 0) + ep -= 3; + if ((size_t)(ep - sec) < ssz + 3 || + strncmp(ep - ssz, search.sec, + ssz) != 0) /* Wrong file */ + prio += 20; /* extension. */ + } if (prio >= best_prio) continue; best_prio = prio; -- To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv