Em Mon, 5 Feb 2024 18:51:33 +0100 Vegard Nossum <vegard.nossum@xxxxxxxxxx> escreveu: > The underlying perl script get_feat.pl does not complain when you pass > nonexistent directories, and just produces empty/useless output: > > $ scripts/get_feat.pl rest --enable-fname --dir asdfasdf --arch arm64 > ==================================== > Feature status on arm64 architecture > ==================================== > > ========= ======= ======= ====== =========== > Subsystem Feature Kconfig Status Description > ========= ======= ======= ====== =========== > ========= ======= ======= ====== =========== > > Let's add an early sanity check and a warning if the check fails. > > get_abi.pl doesn't have exactly the same issue as it actually produces > an error, but we can add the same check for consistency. Fixing it is a good thing, but IMO the change should happen instead at get_abi.pl and get_feat.pl level, as it is a way more likely that someone will misuse it when running the tools via command line than when modifying the places where they're called. > > Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxxx> > --- > Documentation/sphinx/kernel_abi.py | 7 ++++++- > Documentation/sphinx/kernel_feat.py | 8 ++++++-- > 2 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/Documentation/sphinx/kernel_abi.py b/Documentation/sphinx/kernel_abi.py > index 9eb7282cc941..52af2750e634 100644 > --- a/Documentation/sphinx/kernel_abi.py > +++ b/Documentation/sphinx/kernel_abi.py > @@ -79,11 +79,16 @@ class KernelCmd(Directive): > > srctree = os.path.abspath(os.environ["srctree"]) > > + dir_path = os.path.join(srctree, 'Documentation', self.arguments[0]) > + if not os.path.exists(dir_path): > + logger.warning("path does not exist: '%s'", dir_path, > + location=(self.state.document.current_source, self.lineno)) > + > args = [ > os.path.join(srctree, 'scripts/get_abi.pl'), > 'rest', > '--enable-lineno', > - '--dir', os.path.join(srctree, 'Documentation', self.arguments[0]), > + '--dir', dir_path, > ] > > if 'rst' in self.options: > diff --git a/Documentation/sphinx/kernel_feat.py b/Documentation/sphinx/kernel_feat.py > index f1c9e4a54964..e0bc6e03579c 100644 > --- a/Documentation/sphinx/kernel_feat.py > +++ b/Documentation/sphinx/kernel_feat.py > @@ -79,12 +79,16 @@ class KernelFeat(Directive): > > srctree = os.path.abspath(os.environ["srctree"]) > > + dir_path = os.path.join(srctree, 'Documentation', self.arguments[0]) > + if not os.path.exists(dir_path): > + logger.warning("path does not exist: '%s'", dir_path, > + location=(self.state.document.current_source, self.lineno)) > + > args = [ > os.path.join(srctree, 'scripts/get_feat.pl'), > 'rest', > '--enable-fname', > - '--dir', > - os.path.join(srctree, 'Documentation', self.arguments[0]), > + '--dir', dir_path, > ] > > if len(self.arguments) > 1: Thanks, Mauro