rpm-software-management / rpmlint

Tool for checking common errors in rpm packages
GNU General Public License v2.0
131 stars 119 forks source link

license parsing corner case #676

Open spotrh opened 3 years ago

spotrh commented 3 years ago

I think the license regexes needs some adjustment for a corner case. In Fedora, we have a package pending review (sip6) that has this as a license tag:

License: (GPLv2 or GPLv3) and (GPLv2+ with exceptions)

rpmlint returns:

sip6.src: W: invalid-license-exception exceptions) sip6.src: W: invalid-license (GPLv2+

marxin commented 3 years ago

Note that rpmlint uses SPDX License List as defined here: https://spdx.org/licenses/. So my guess is that you need something like GPL-2.0-with-autoconf-exception, in your case sip6..

Conan-Kudo commented 3 years ago

Not for Fedora, it doesn't. It still uses the traditional RPM shorthand identifiers.

marxin commented 3 years ago

Not for Fedora, it doesn't. It still uses the traditional RPM shorthand identifiers.

What do you suggest for the mentioned license (License: (GPLv2 or GPLv3) and (GPLv2+ with exceptions)) ? What can we do?

Conan-Kudo commented 3 years ago

I'm not sure. I think we're probably not handling whitespace in the field properly.

marxin commented 3 years ago

Oh, you are right, I haven't noticed the split error messages.

marxin commented 3 years ago

I can confirm the parsing can be improved to the following tokens: GPLv2, GPLv3 and GPLv2+ (+ exception=exceptions). Anyway, I'm not planning to work on that right now..

smooge commented 2 years ago

I have closed #769 as this is the ticket I need to track

xsuchy commented 1 week ago

Note that for Fedora you can use BNF grammar that comes in fedora-license-data package in a file /usr/share/fedora-license-data/grammar.lark.