Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brackets in spdx license expression rejected by as_is_spdx_license_expression #469

Conversation

caolanm
Copy link
Contributor

@caolanm caolanm commented Mar 8, 2023

something like: "CC0-1.0 AND (BSD-3-Clause OR LGPL-2.1-only)" is reported by appstreamcli check-license as "invalid" and not "Free and Open Source"

$ appstreamcli check-license "CC0-1.0 AND (BSD-3-Clause OR LGPL-2.1-only)" License Type: invalid
Suitable for AppStream metadata: no
Free and Open Source: no

Trying to debug I find that "as_license_is_free_license" accepts this string as valid, but that "as_is_spdx_license_expression" considers it invalid due to the presence of "(" and ")" so it is rejected there and so ascli_check_license goes on to use as_license_to_spdx_id which turns it into "CC0-1.0-1.0 AND (BSD-3-Clause-3-Clause OR LGPL-2.1-only)" ascli_check_license is ok with brackets, but at this point its mangled and understandably fails.

In fedora in practice I see gnome-software designate libreoffice langpacks as "Proprietary Code" when a similar license tag is extracted from the rpm and propogated into appstream.

https://bugs.documentfoundation.org/show_bug.cgi?id=154056

…pression

something like: "CC0-1.0 AND (BSD-3-Clause OR LGPL-2.1-only)"
is reported by appstreamcli check-license as "invalid" and not "Free and
Open Source"

$ appstreamcli check-license "CC0-1.0 AND (BSD-3-Clause OR LGPL-2.1-only)"
License Type: invalid
Suitable for AppStream metadata: no
Free and Open Source: no

Trying to debug I find that "as_license_is_free_license" accepts this
string as valid, but that "as_is_spdx_license_expression" considers
it invalid due to the presence of "(" and ")" so it is rejected there
and so ascli_check_license goes on to use as_license_to_spdx_id which
turns it into "CC0-1.0-1.0 AND (BSD-3-Clause-3-Clause OR LGPL-2.1-only)"
ascli_check_license is ok with brackets, but at this point its mangled
and understandably fails.

In fedora in practice I see gnome-software designate libreoffice
langpacks as "Proprietary Code" when a similar license tag is extracted
from the rpm and propogated into appstream.

https://bugs.documentfoundation.org/show_bug.cgi?id=154056
@ximion
Copy link
Owner

ximion commented Apr 11, 2023

Sorry for the delay in reviewing! This patch looks good as-is, thank you!

@ximion ximion merged commit c51bb43 into ximion:master Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants