| Message ID | 20260721152543.3468210-1-dmitry.baryshkov@oss.qualcomm.com |
|---|---|
| State | Under Review |
| Headers | show |
| Series | license: fix list_licenses() crash on CLOSED and empty licenses | expand |
On Tue, Jul 21, 2026 at 9:26 AM Dmitry Baryshkov via lists.openembedded.org <dmitry.baryshkov=oss.qualcomm.com@lists.openembedded.org> wrote: > 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(). > LGTM, thanks. Reviewed-by: Joshua Watt <JPEWhacker@gmail.com> > > 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> > --- > meta/lib/oe/license.py | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py > index a1dce143dd20..adcfc827cfc0 100644 > --- a/meta/lib/oe/license.py > +++ b/meta/lib/oe/license.py > @@ -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): > -- > 2.47.3 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#241552): > https://lists.openembedded.org/g/openembedded-core/message/241552 > Mute This Topic: https://lists.openembedded.org/mt/120378577/3616693 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > JPEWhacker@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py index a1dce143dd20..adcfc827cfc0 100644 --- a/meta/lib/oe/license.py +++ b/meta/lib/oe/license.py @@ -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):
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> --- meta/lib/oe/license.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)