Re: [PATCH 1/8] docs: kernel_feat.py: fix build error for missing files

From
Mauro Carvalho Chehab <mchehab@kernel.org>
Date
2024-02-06 04:30:14
Also in
stable
Reply to
Vegard Nossum, 2024-02-05
Em Mon,  5 Feb 2024 18:51:26 +0100
Vegard Nossum [off-list ref] escreveu:
If the directory passed to the '.. kernel-feat::' directive does not
exist or the get_feat.pl script does not find any files to extract
features from, Sphinx will report the following error:

    Sphinx parallel build error:
    UnboundLocalError: local variable 'fname' referenced before assignment
    make[2]: *** [Documentation/Makefile:102: htmldocs] Error 2

This is due to how I changed the script in c48a7c44a1d0 ("docs:
kernel_feat.py: fix potential command injection"). Before that, the
filename passed along to self.nestedParse() in this case was weirdly
just the whole get_feat.pl invocation.

We can fix it by doing what kernel_abi.py does -- just pass
self.arguments[0] as 'fname'.

Fixes: c48a7c44a1d0 ("docs: kernel_feat.py: fix potential command injection")
Cc: Justin Forbes <redacted>
Cc: Salvatore Bonaccorso <redacted>
Cc: Jani Nikula <redacted>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: <redacted>
Signed-off-by: Vegard Nossum <redacted>
Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
quoted hunk ↗ jump to hunk
---
 Documentation/sphinx/kernel_feat.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/sphinx/kernel_feat.py b/Documentation/sphinx/kernel_feat.py
index b9df61eb4501..03ace5f01b5c 100644
--- a/Documentation/sphinx/kernel_feat.py
+++ b/Documentation/sphinx/kernel_feat.py
@@ -109,7 +109,7 @@ class KernelFeat(Directive):
             else:
                 out_lines += line + "\n"
 
-        nodeList = self.nestedParse(out_lines, fname)
+        nodeList = self.nestedParse(out_lines, self.arguments[0])
         return nodeList
 
     def nestedParse(self, lines, fname):


Thanks,
Mauro
Thread (32 messages) 32 messages, 6 authors, last reply 2024-02-08
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help