]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
license: fix list_licenses() crash on CLOSED and empty licenses
authorDmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Tue, 21 Jul 2026 15:25:43 +0000 (18:25 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 23 Jul 2026 10:27:21 +0000 (11:27 +0100)
oe.license.list_licenses() passes the result of parse_legacy_license()
straight into walk_license(), which unconditionally iterates
node.children. For LICENSE = "CLOSED" (and for an empty license string)
parse_legacy_license() returns None, so walk_license(None) dereferences
None.children and aborts do_package_qa with:

  AttributeError: 'NoneType' object has no attribute 'children'

This breaks packaging for every CLOSED-licensed recipe reaching the
obsolete-license QA check.

Guard the walk against a None node, mirroring the existing "if node:"
check in the neighbouring apply_pkg_license_exclusion().

Fixes: e9d424738d6f ("classes/conf/lib: Parse LICENSE as SPDX Expression")
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/license.py

index a1dce143dd20ee3dc589cbdf1327b9c8ec85ed79..adcfc827cfc02cc842cc845e254e4b9828813cca 100644 (file)
@@ -235,7 +235,9 @@ def list_licenses(licensestr, d):
         for child in node.children:
             walk_license(child)
 
-    walk_license(parse_legacy_license(d, licensestr))
+    node = parse_legacy_license(d, licensestr)
+    if node:
+        walk_license(node)
     return set(licenses)
 
 def return_spdx(d, license):