docs: maintainers_include: properly handle file patterns

handling asterisks inside file patterns atdescription part is
problematic, as ReST has special meaning for them. Due to
that, convert such patterns to literal strings.

Reported-by: Matteo Croce <teknoraver@meta.com>
Fixes: 420849332f ("get_maintainer: add ** glob pattern support")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Message-ID: <89127706fb3493d00ecb21e528c8a27081e5ed40.1777987027.git.mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <abd5112fea4dd480f5e72ba46fe60c2463862829.1778309595.git.mchehab+huawei@kernel.org>
This commit is contained in:
Mauro Carvalho Chehab 2026-05-09 08:56:40 +02:00 committed by Jonathan Corbet
parent 1aac8eff9a
commit 083f0b10f5

View File

@ -47,9 +47,6 @@ class MaintainersParser:
self.maintainers = False
self.subsystems = False
# Field letter to field name mapping.
self.field_letter = None
self.subsystem_name = None
self.app_dir = os.path.abspath(app_dir)
@ -125,19 +122,22 @@ class MaintainersParser:
self.header += "\n" + line
return
# Escape the escapes in preformatted text.
self.header += "| " + self.linkify(line).replace("\\", "\\\\")
# Look for and record field letter to field name mappings:
# R: Designated *reviewer*: FullName <address@domain>
m = re.search(r"\s(\S):\s", line)
m = re.match(r"\s+(\S):\s+(\S+)", line)
if m:
self.field_letter = m.group(1)
field = m.group(1)
details = m.group(2)
if field not in self.fields:
m = re.search(r"\*([^\*]+)\*", line)
if m:
self.fields[field] = m.group(1)
elif field in ['F', 'N', 'X', 'K']:
line = line.replace(details, f'``{details}``')
self.header += "| " + self.linkify(line)
if self.field_letter and self.field_letter not in self.fields:
m = re.search(r"\*([^\*]+)\*", line)
if m:
self.fields[self.field_letter] = m.group(1)
def parse_subsystems(self, line):
"""Handle contents of the per-subsystem sections."""
@ -206,7 +206,7 @@ class MaintainersParser:
#
if field in ['F', 'N', 'X', 'K']:
# But only if not already marked :)
if not ':doc:' in details:
if ':doc:' not in details and "http" not in details:
details = '``%s``' % (details)
if self.subsystem_name not in self.maint_entries: