Skip to content

Duplicated record [potential filter for low score] for license_expression #2139

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

Closed
chinyeungli opened this issue Jul 29, 2020 · 2 comments
Closed

Comments

@chinyeungli
Copy link
Contributor

Description

For https://changelogs.ubuntu.com/changelogs/pool/universe/x/xvidcore/xvidcore_1.3.4-1/copyright , the license detection returns the following:

    {
      "path": "libxvidcore4/copyright",
      "type": "file",
      "licenses": [
        {
          "key": "gpl-2.0-plus",
          "score": 73.46,
          "name": "GNU General Public License 2.0 or later",
          "short_name": "GPL 2.0 or later",
          "category": "Copyleft",
          "is_exception": false,
          "owner": "Free Software Foundation (FSF)",
          "homepage_url": "http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html",
          "text_url": "http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html",
          "reference_url": "https://enterprise.dejacode.com/urn/urn:dje:license:gpl-2.0-plus",
          "spdx_license_key": "GPL-2.0-or-later",
          "spdx_url": "https://spdx.org/licenses/GPL-2.0-or-later",
          "start_line": 53,
          "end_line": 84,
          "matched_rule": {
            "identifier": "gpl-2.0-plus_and_gpl-3.0.RULE",
            "license_expression": "gpl-2.0-plus AND gpl-3.0",
            "licenses": [
              "gpl-2.0-plus",
              "gpl-3.0"
            ],
            "is_license_text": false,
            "is_license_notice": true,
            "is_license_reference": false,
            "is_license_tag": false,
            "matcher": "3-seq",
            "rule_length": 162,
            "matched_length": 119,
            "match_coverage": 73.46,
            "rule_relevance": 100
          }
        },
        {
          "key": "gpl-3.0",
          "score": 73.46,
          "name": "GNU General Public License 3.0",
          "short_name": "GPL 3.0",
          "category": "Copyleft",
          "is_exception": false,
          "owner": "Free Software Foundation (FSF)",
          "homepage_url": "http://www.gnu.org/licenses/gpl-3.0.html",
          "text_url": "http://www.gnu.org/licenses/gpl-3.0-standalone.html",
          "reference_url": "https://enterprise.dejacode.com/urn/urn:dje:license:gpl-3.0",
          "spdx_license_key": "GPL-3.0-only",
          "spdx_url": "https://spdx.org/licenses/GPL-3.0-only",
          "start_line": 53,
          "end_line": 84,
          "matched_rule": {
            "identifier": "gpl-2.0-plus_and_gpl-3.0.RULE",
            "license_expression": "gpl-2.0-plus AND gpl-3.0",
            "licenses": [
              "gpl-2.0-plus",
              "gpl-3.0"
            ],
            "is_license_text": false,
            "is_license_notice": true,
            "is_license_reference": false,
            "is_license_tag": false,
            "matcher": "3-seq",
            "rule_length": 162,
            "matched_length": 119,
            "match_coverage": 73.46,
            "rule_relevance": 100
          }
        },
        {
          "key": "gpl-2.0-plus",
          "score": 100.0,
          "name": "GNU General Public License 2.0 or later",
          "short_name": "GPL 2.0 or later",
          "category": "Copyleft",
          "is_exception": false,
          "owner": "Free Software Foundation (FSF)",
          "homepage_url": "http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html",
          "text_url": "http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html",
          "reference_url": "https://enterprise.dejacode.com/urn/urn:dje:license:gpl-2.0-plus",
          "spdx_license_key": "GPL-2.0-or-later",
          "spdx_url": "https://spdx.org/licenses/GPL-2.0-or-later",
          "start_line": 62,
          "end_line": 62,
          "matched_rule": {
            "identifier": "gpl-2.0-plus_22.RULE",
            "license_expression": "gpl-2.0-plus",
            "licenses": [
              "gpl-2.0-plus"
            ],
            "is_license_text": false,
            "is_license_notice": false,
            "is_license_reference": true,
            "is_license_tag": false,
            "matcher": "2-aho",
            "rule_length": 3,
            "matched_length": 3,
            "match_coverage": 100.0,
            "rule_relevance": 100.0
          }
        },
        {
          "key": "lgpl-2.0-plus",
          "score": 16.0,
          "name": "GNU Library General Public License 2.0 or later",
          "short_name": "LGPL 2.0 or later",
          "category": "Copyleft Limited",
          "is_exception": false,
          "owner": "Free Software Foundation (FSF)",
          "homepage_url": "http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html",
          "text_url": "http://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html",
          "reference_url": "https://enterprise.dejacode.com/urn/urn:dje:license:lgpl-2.0-plus",
          "spdx_license_key": "LGPL-2.0-or-later",
          "spdx_url": "https://spdx.org/licenses/LGPL-2.0-or-later",
          "start_line": 67,
          "end_line": 67,
          "matched_rule": {
            "identifier": "lgpl-2.0-plus_61.RULE",
            "license_expression": "lgpl-2.0-plus",
            "licenses": [
              "lgpl-2.0-plus"
            ],
            "is_license_text": false,
            "is_license_notice": false,
            "is_license_reference": true,
            "is_license_tag": false,
            "matcher": "2-aho",
            "rule_length": 3,
            "matched_length": 3,
            "match_coverage": 100.0,
            "rule_relevance": 16
          }
        },
        {
          "key": "gpl-2.0-plus",
          "score": 100.0,
          "name": "GNU General Public License 2.0 or later",
          "short_name": "GPL 2.0 or later",
          "category": "Copyleft",
          "is_exception": false,
          "owner": "Free Software Foundation (FSF)",
          "homepage_url": "http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html",
          "text_url": "http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html",
          "reference_url": "https://enterprise.dejacode.com/urn/urn:dje:license:gpl-2.0-plus",
          "spdx_license_key": "GPL-2.0-or-later",
          "spdx_url": "https://spdx.org/licenses/GPL-2.0-or-later",
          "start_line": 69,
          "end_line": 69,
          "matched_rule": {
            "identifier": "gpl-2.0-plus_22.RULE",
            "license_expression": "gpl-2.0-plus",
            "licenses": [
              "gpl-2.0-plus"
            ],
            "is_license_text": false,
            "is_license_notice": false,
            "is_license_reference": true,
            "is_license_tag": false,
            "matcher": "2-aho",
            "rule_length": 3,
            "matched_length": 3,
            "match_coverage": 100.0,
            "rule_relevance": 100.0
          }
        },
        {
          "key": "lgpl-2.0-plus",
          "score": 16.0,
          "name": "GNU Library General Public License 2.0 or later",
          "short_name": "LGPL 2.0 or later",
          "category": "Copyleft Limited",
          "is_exception": false,
          "owner": "Free Software Foundation (FSF)",
          "homepage_url": "http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html",
          "text_url": "http://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html",
          "reference_url": "https://enterprise.dejacode.com/urn/urn:dje:license:lgpl-2.0-plus",
          "spdx_license_key": "LGPL-2.0-or-later",
          "spdx_url": "https://spdx.org/licenses/LGPL-2.0-or-later",
          "start_line": 86,
          "end_line": 86,
          "matched_rule": {
            "identifier": "lgpl-2.0-plus_61.RULE",
            "license_expression": "lgpl-2.0-plus",
            "licenses": [
              "lgpl-2.0-plus"
            ],
            "is_license_text": false,
            "is_license_notice": false,
            "is_license_reference": true,
            "is_license_tag": false,
            "matcher": "2-aho",
            "rule_length": 3,
            "matched_length": 3,
            "match_coverage": 100.0,
            "rule_relevance": 16
          }
        },
        {
          "key": "lgpl-2.1-plus",
          "score": 92.86,
          "name": "GNU Lesser General Public License 2.1 or later",
          "short_name": "LGPL 2.1 or later",
          "category": "Copyleft Limited",
          "is_exception": false,
          "owner": "Free Software Foundation (FSF)",
          "homepage_url": "http://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html",
          "text_url": "http://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html",
          "reference_url": "https://enterprise.dejacode.com/urn/urn:dje:license:lgpl-2.1-plus",
          "spdx_license_key": "LGPL-2.1-or-later",
          "spdx_url": "https://spdx.org/licenses/LGPL-2.1-or-later",
          "start_line": 86,
          "end_line": 98,
          "matched_rule": {
            "identifier": "lgpl-2.1-plus_114.RULE",
            "license_expression": "lgpl-2.1-plus",
            "licenses": [
              "lgpl-2.1-plus"
            ],
            "is_license_text": false,
            "is_license_notice": true,
            "is_license_reference": false,
            "is_license_tag": false,
            "matcher": "3-seq",
            "rule_length": 112,
            "matched_length": 104,
            "match_coverage": 92.86,
            "rule_relevance": 100
          }
        },
        {
          "key": "agpl-3.0",
          "score": 6.52,
          "name": "GNU Affero General Public License 3.0",
          "short_name": "AGPL 3.0",
          "category": "Copyleft",
          "is_exception": false,
          "owner": "Free Software Foundation (FSF)",
          "homepage_url": "http://www.gnu.org/licenses/agpl-3.0.html",
          "text_url": "http://www.fsf.org/licensing/licenses/agpl-3.0.html",
          "reference_url": "https://enterprise.dejacode.com/urn/urn:dje:license:agpl-3.0",
          "spdx_license_key": "AGPL-3.0-only",
          "spdx_url": "https://spdx.org/licenses/AGPL-3.0-only",
          "start_line": 100,
          "end_line": 100,
          "matched_rule": {
            "identifier": "agpl-3.0_37.RULE",
            "license_expression": "agpl-3.0",
            "licenses": [
              "agpl-3.0"
            ],
            "is_license_text": false,
            "is_license_notice": true,
            "is_license_reference": false,
            "is_license_tag": false,
            "matcher": "3-seq",
            "rule_length": 92,
            "matched_length": 6,
            "match_coverage": 6.52,
            "rule_relevance": 100
          }
        },
        {
          "key": "lgpl-2.0",
          "score": 100.0,
          "name": "GNU Library General Public License 2.0",
          "short_name": "LGPL 2.0",
          "category": "Copyleft Limited",
          "is_exception": false,
          "owner": "Free Software Foundation (FSF)",
          "homepage_url": "http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html",
          "text_url": "http://www.gnu.org/licenses/lgpl-2.0.html",
          "reference_url": "https://enterprise.dejacode.com/urn/urn:dje:license:lgpl-2.0",
          "spdx_license_key": "LGPL-2.0-only",
          "spdx_url": "https://spdx.org/licenses/LGPL-2.0-only",
          "start_line": 101,
          "end_line": 101,
          "matched_rule": {
            "identifier": "lgpl-2.0_37.RULE",
            "license_expression": "lgpl-2.0",
            "licenses": [
              "lgpl-2.0"
            ],
            "is_license_text": false,
            "is_license_notice": false,
            "is_license_reference": false,
            "is_license_tag": true,
            "matcher": "2-aho",
            "rule_length": 2,
            "matched_length": 2,
            "match_coverage": 100.0,
            "rule_relevance": 100.0
          }
        }
      ],
      "license_expressions": [
        "gpl-2.0-plus AND gpl-3.0",
        "gpl-2.0-plus",
        "lgpl-2.0-plus",
        "gpl-2.0-plus",
        "lgpl-2.0-plus",
        "lgpl-2.1-plus",
        "agpl-3.0",
        "lgpl-2.0"
      ],
      "scan_errors": []
    }

Note that there are duplicated result in the license_expression which doesn't look good.
In addition, the agpl-3.0 is incorrect based on the low score, but it's included in the license_expression. Do we have a way/plan to only capture high score licenses in the license_expression?

@pombredanne
Copy link
Member

This can be solved with a few extra rules and this is a poster child test for the solution proposed in #2637
At the moment the results returned are:

"license_expressions": [
  "gpl-2.0-plus",
  "gpl-2.0-plus",
  "lgpl-2.0-plus",
  "gpl-2.0-plus",
  "gpl-2.0-plus",
  "lgpl-2.0-plus",
  "lgpl-3.0-plus",
  "lgpl-2.0"
],

@DennisClark
Copy link
Member

Using scancode-toolkit-v32.3.3 to scan the test file identified in this issue, I get

          "declared_license_expression": "gpl-2.0-plus AND (lgpl-2.0-plus AND gpl-2.0-plus)",
          "declared_license_expression_spdx": "GPL-2.0-or-later AND (LGPL-2.0-or-later AND GPL-2.0-or-later)",

and definitely no sign of agpl-3.0
so I think there has been significant improvement Closing.

copyright-results.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants