]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
doc tools: better handle KBUILD_VERBOSE
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 27 Mar 2026 05:57:48 +0000 (06:57 +0100)
committerJonathan Corbet <corbet@lwn.net>
Mon, 30 Mar 2026 16:03:40 +0000 (10:03 -0600)
As reported by Jacob, there are troubles when KBUILD_VERBOSE is
set at the environment.

Fix it on both kernel-doc and sphinx-build-wrapper.

Reported-by: Jacob Keller <jacob.e.keller@intel.com>
Closes: https://lore.kernel.org/linux-doc/9367d899-53af-4d9c-9320-22fc4dbadca5@intel.com/
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tested-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <7a99788db75630fb14828d612c0fd77c45ec1891.1774591065.git.mchehab+huawei@kernel.org>

tools/docs/sphinx-build-wrapper
tools/lib/python/kdoc/kdoc_files.py

index 2c63d28f639d65bbecad086db0fee934e6e8b581..1bb962202784cb7c738cb51104ba69e01a68493c 100755 (executable)
@@ -238,7 +238,12 @@ class SphinxBuilder:
             self.latexopts = os.environ.get("LATEXOPTS", "")
 
         if not verbose:
-            verbose = bool(os.environ.get("KBUILD_VERBOSE", "") != "")
+            try:
+                verbose = bool(int(os.environ.get("KBUILD_VERBOSE", 0)))
+            except ValueError:
+                # Handles an eventual case where verbosity is not a number
+                # like KBUILD_VERBOSE=""
+                verbose = False
 
         if verbose is not None:
             self.verbose = verbose
index 2428cfc4e843048cb349d265dfbf3794b1c6d1be..ed82b6e6ab25b215f9316c4cc47fa63f167e4d80 100644 (file)
@@ -238,7 +238,12 @@ class KernelFiles():
         """
 
         if not verbose:
-            verbose = bool(os.environ.get("KBUILD_VERBOSE", 0))
+            try:
+                verbose = bool(int(os.environ.get("KBUILD_VERBOSE", 0)))
+            except ValueError:
+                # Handles an eventual case where verbosity is not a number
+                # like KBUILD_VERBOSE=""
+                verbose = False
 
         if out_style is None:
             out_style = OutputFormat()