Bug #6200
closedgit-pbchk manlint regexp could be improved
0%
Description
The current manlint is a bit too generic while picking up manual pages:
ManfileRE = re.compile(r'.*\.[0-9][a-z]*$', re.IGNORECASE)
it means anything with suffix digit followed by chars from a-z will be considered as manual page. However, in illumos-gate the man pages are located in usr/src/man/man<section> tree and should therefore have suffix '.<section>'. In addition, the section name is not limited with number at start of the section name.
So the idea is to use following RE instead:
ManfileRE = re.compile(r'(.*/man(?P<foo>\d\w*)/.*\.(?P=foo))$', re.IGNORECASE)
it checks for man<section> where <section> still has to start with digit, but may contain chars and digits, and the file name must end with this section name. This RE will not limit the actual location of man<section> directory, but will reduce false positives.
Change suggested by Yuri Pankov, hint for RE from PMT on #illumos irc channel.