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

GPL-2.0-only detected in GPL-2.0-or-later #3128

Open
pepper-jk opened this issue Oct 19, 2022 · 20 comments
Open

GPL-2.0-only detected in GPL-2.0-or-later #3128

pepper-jk opened this issue Oct 19, 2022 · 20 comments
Labels

Comments

@pepper-jk
Copy link

pepper-jk commented Oct 19, 2022

Background

I am currently working on copyleft license compatibility rules for ORT. For this I created a test repository containing GPL-2.0-or-later and GPL-3.0 (later I added some CC licenses as well, but those are not relevant to the issue). Both license texts were copied from spdx.org.

ORT issue: oss-review-toolkit/ort#5967

Description of Bug

When scanning said test repository with ORT, scancode detects both GPL-2.0-only and GPL-2.0-or-later, even though only GPL-2.0-or-later was added to the repo:

- license: "GPL-2.0-only"
  location:
    path: "license-gpl-2.0-or-later.txt"
    start_line: 3
    end_line: 110
  score: 98.02
- license: "GPL-2.0-or-later"
  location:
    path: "license-gpl-2.0-or-later.txt"
    start_line: 110
    end_line: 114
  score: 100.0

As you can see scancode gives GPL-2.0-only a 98.02 score, even though it ignores the last 4 lines of the license text. And GPL-2.0-or-later only is detected in the last four lines.

Later I ran a scan directly with scancode, getting the same results:

complete json
{
  "headers": [
    {
      "tool_name": "scancode-toolkit",
      "tool_version": "31.2.1",
      "options": {
        "input": [
          "."
        ],
        "--copyright": true,
        "--info": true,
        "--json-pp": "report-scancode.json",
        "--license": true,
        "--package": true,
        "--verbose": true
      },
      "notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.",
      "start_timestamp": "2022-10-19T140338.813472",
      "end_timestamp": "2022-10-19T140353.061902",
      "output_format_version": "2.0.0",
      "duration": 14.248444318771362,
      "message": null,
      "errors": [],
      "warnings": [],
      "extra_data": {
        "system_environment": {
          "operating_system": "linux",
          "cpu_architecture": "64",
          "platform": "Linux-5.15.0-50-generic-x86_64-with-glibc2.35",
          "platform_version": "#56-Ubuntu SMP Tue Sep 20 13:23:26 UTC 2022",
          "python_version": "3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0]"
        },
        "spdx_license_list_version": "3.17",
        "files_count": 5
      }
    }
  ],
  "dependencies": [],
  "packages": [],
  "files": [
    {
      "path": "compatibility_test",
      "type": "directory",
      "name": "compatibility_test",
      "base_name": "compatibility_test",
      "extension": "",
      "size": 0,
      "date": null,
      "sha1": null,
      "md5": null,
      "sha256": null,
      "mime_type": null,
      "file_type": null,
      "programming_language": null,
      "is_binary": false,
      "is_text": false,
      "is_archive": false,
      "is_media": false,
      "is_source": false,
      "is_script": false,
      "licenses": [],
      "license_expressions": [],
      "percentage_of_license_text": 0,
      "copyrights": [],
      "holders": [],
      "authors": [],
      "package_data": [],
      "for_packages": [],
      "files_count": 5,
      "dirs_count": 0,
      "size_count": 94469,
      "scan_errors": []
    },
    {
      "path": "compatibility_test/CC-BY-NC-SA-3.0.txt",
      "type": "file",
      "name": "CC-BY-NC-SA-3.0.txt",
      "base_name": "CC-BY-NC-SA-3.0",
      "extension": ".txt",
      "size": 21448,
      "date": "2022-10-18",
      "sha1": "7295cb93cd11ad9912bbc495a3ef6d7a91cdb44c",
      "md5": "666f6d1f58d456548a3156f86e7a3146",
      "sha256": "0abe2645856e5e739bf858bbedc527bb58d053f628880c9e9a26ef85d2f7c713",
      "mime_type": "text/plain",
      "file_type": "ASCII text, with very long lines",
      "programming_language": null,
      "is_binary": false,
      "is_text": true,
      "is_archive": false,
      "is_media": false,
      "is_source": false,
      "is_script": false,
      "licenses": [
        {
          "key": "cc-by-nc-sa-3.0",
          "score": 100.0,
          "name": "Creative Commons Attribution Non-Commercial Share Alike License 3.0",
          "short_name": "CC-BY-NC-SA-3.0",
          "category": "Source-available",
          "is_exception": false,
          "is_unknown": false,
          "owner": "Creative Commons",
          "homepage_url": "http://creativecommons.org/licenses/by-nc-sa/3.0/",
          "text_url": "http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode",
          "reference_url": "https://scancode-licensedb.aboutcode.org/cc-by-nc-sa-3.0",
          "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/cc-by-nc-sa-3.0.LICENSE",
          "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/cc-by-nc-sa-3.0.yml",
          "spdx_license_key": "CC-BY-NC-SA-3.0",
          "spdx_url": "https://spdx.org/licenses/CC-BY-NC-SA-3.0",
          "start_line": 3,
          "end_line": 63,
          "matched_rule": {
            "identifier": "cc-by-nc-sa-3.0_47.RULE",
            "license_expression": "cc-by-nc-sa-3.0",
            "licenses": [
              "cc-by-nc-sa-3.0"
            ],
            "referenced_filenames": [],
            "is_license_text": true,
            "is_license_notice": false,
            "is_license_reference": false,
            "is_license_tag": false,
            "is_license_intro": false,
            "has_unknown": false,
            "matcher": "1-hash",
            "rule_length": 3360,
            "matched_length": 3360,
            "match_coverage": 100.0,
            "rule_relevance": 100
          }
        }
      ],
      "license_expressions": [
        "cc-by-nc-sa-3.0"
      ],
      "percentage_of_license_text": 100.0,
      "copyrights": [],
      "holders": [],
      "authors": [],
      "package_data": [],
      "for_packages": [],
      "files_count": 0,
      "dirs_count": 0,
      "size_count": 0,
      "scan_errors": []
    },
    {
      "path": "compatibility_test/CC-BY-NC-SA-4.0.txt",
      "type": "file",
      "name": "CC-BY-NC-SA-4.0.txt",
      "base_name": "CC-BY-NC-SA-4.0",
      "extension": ".txt",
      "size": 19066,
      "date": "2022-10-18",
      "sha1": "c7b58be452219bd8b74710dd9e6e7ed449517da0",
      "md5": "4a206eed80a3482b8fbf26350ead4538",
      "sha256": "f5992db54c7473dcda6f16a40679d305aa31440489fdcb1eaca84d7da6290ee4",
      "mime_type": "text/plain",
      "file_type": "UTF-8 Unicode text, with very long lines",
      "programming_language": null,
      "is_binary": false,
      "is_text": true,
      "is_archive": false,
      "is_media": false,
      "is_source": false,
      "is_script": false,
      "licenses": [
        {
          "key": "cc-by-nc-sa-4.0",
          "score": 100.0,
          "name": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License",
          "short_name": "CC-BY-NC-SA-4.0",
          "category": "Source-available",
          "is_exception": false,
          "is_unknown": false,
          "owner": "Creative Commons",
          "homepage_url": "http://creativecommons.org/licenses/by-nc-sa/4.0/",
          "text_url": "http://creativecommons.org/licenses/by-nc-sa/4.0/legalcode",
          "reference_url": "https://scancode-licensedb.aboutcode.org/cc-by-nc-sa-4.0",
          "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/cc-by-nc-sa-4.0.LICENSE",
          "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/cc-by-nc-sa-4.0.yml",
          "spdx_license_key": "CC-BY-NC-SA-4.0",
          "spdx_url": "https://spdx.org/licenses/CC-BY-NC-SA-4.0",
          "start_line": 3,
          "end_line": 117,
          "matched_rule": {
            "identifier": "cc-by-nc-sa-4.0_23.RULE",
            "license_expression": "cc-by-nc-sa-4.0",
            "licenses": [
              "cc-by-nc-sa-4.0"
            ],
            "referenced_filenames": [],
            "is_license_text": true,
            "is_license_notice": false,
            "is_license_reference": false,
            "is_license_tag": false,
            "is_license_intro": false,
            "has_unknown": false,
            "matcher": "1-hash",
            "rule_length": 2861,
            "matched_length": 2861,
            "match_coverage": 100.0,
            "rule_relevance": 100
          }
        }
      ],
      "license_expressions": [
        "cc-by-nc-sa-4.0"
      ],
      "percentage_of_license_text": 100.0,
      "copyrights": [],
      "holders": [],
      "authors": [],
      "package_data": [],
      "for_packages": [],
      "files_count": 0,
      "dirs_count": 0,
      "size_count": 0,
      "scan_errors": []
    },
    {
      "path": "compatibility_test/license-gpl-2.0-or-later.txt",
      "type": "file",
      "name": "license-gpl-2.0-or-later.txt",
      "base_name": "license-gpl-2.0-or-later",
      "extension": ".txt",
      "size": 18229,
      "date": "2022-10-18",
      "sha1": "040cfa18ce31bbc2748537fe3f8aedfb25af6165",
      "md5": "d736fb04757076bd90e1677e9aa37230",
      "sha256": "1cc9cfdb6b5d3737e3c672d938c0e1ed7070ed1ed631b4e881076e1eabaafccf",
      "mime_type": "text/plain",
      "file_type": "ASCII text, with very long lines",
      "programming_language": null,
      "is_binary": false,
      "is_text": true,
      "is_archive": false,
      "is_media": false,
      "is_source": false,
      "is_script": false,
      "licenses": [
        {
          "key": "gpl-2.0",
          "score": 98.02,
          "name": "GNU General Public License 2.0",
          "short_name": "GPL 2.0",
          "category": "Copyleft",
          "is_exception": false,
          "is_unknown": false,
          "owner": "Free Software Foundation (FSF)",
          "homepage_url": "http://www.gnu.org/licenses/gpl-2.0.html",
          "text_url": "http://www.gnu.org/licenses/gpl-2.0.txt",
          "reference_url": "https://scancode-licensedb.aboutcode.org/gpl-2.0",
          "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.LICENSE",
          "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.yml",
          "spdx_license_key": "GPL-2.0-only",
          "spdx_url": "https://spdx.org/licenses/GPL-2.0-only",
          "start_line": 3,
          "end_line": 110,
          "matched_rule": {
            "identifier": "gpl-2.0.LICENSE",
            "license_expression": "gpl-2.0",
            "licenses": [
              "gpl-2.0"
            ],
            "referenced_filenames": [],
            "is_license_text": true,
            "is_license_notice": false,
            "is_license_reference": false,
            "is_license_tag": false,
            "is_license_intro": false,
            "has_unknown": false,
            "matcher": "3-seq",
            "rule_length": 2931,
            "matched_length": 2873,
            "match_coverage": 98.02,
            "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,
          "is_unknown": 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://scancode-licensedb.aboutcode.org/gpl-2.0-plus",
          "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.LICENSE",
          "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.yml",
          "spdx_license_key": "GPL-2.0-or-later",
          "spdx_url": "https://spdx.org/licenses/GPL-2.0-or-later",
          "start_line": 110,
          "end_line": 114,
          "matched_rule": {
            "identifier": "gpl-2.0-plus_420.RULE",
            "license_expression": "gpl-2.0-plus",
            "licenses": [
              "gpl-2.0-plus"
            ],
            "referenced_filenames": [],
            "is_license_text": false,
            "is_license_notice": true,
            "is_license_reference": false,
            "is_license_tag": false,
            "is_license_intro": false,
            "has_unknown": false,
            "matcher": "2-aho",
            "rule_length": 113,
            "matched_length": 113,
            "match_coverage": 100.0,
            "rule_relevance": 100
          }
        }
      ],
      "license_expressions": [
        "gpl-2.0",
        "gpl-2.0-plus"
      ],
      "percentage_of_license_text": 98.94,
      "copyrights": [
        {
          "copyright": "Copyright (c) 1989, 1991 Free Software Foundation, Inc.",
          "start_line": 6,
          "end_line": 6
        },
        {
          "copyright": "copyrighted by the Free Software Foundation",
          "start_line": 69,
          "end_line": 69
        }
      ],
      "holders": [
        {
          "holder": "Free Software Foundation, Inc.",
          "start_line": 6,
          "end_line": 6
        },
        {
          "holder": "the Free Software Foundation",
          "start_line": 69,
          "end_line": 69
        }
      ],
      "authors": [],
      "package_data": [],
      "for_packages": [],
      "files_count": 0,
      "dirs_count": 0,
      "size_count": 0,
      "scan_errors": []
    },
    {
      "path": "compatibility_test/license-gpl-3.0.txt",
      "type": "file",
      "name": "license-gpl-3.0.txt",
      "base_name": "license-gpl-3.0",
      "extension": ".txt",
      "size": 35405,
      "date": "2022-10-18",
      "sha1": "579b08f7066f9491391a5eb2e9f238a71f4d4981",
      "md5": "2103bb15c50dc81f64b2315ab249ad3d",
      "sha256": "44d90a331f505bd19b626cef0e3ae59da08830cf8b9efbde5f71025faa3c463b",
      "mime_type": "text/plain",
      "file_type": "UTF-8 Unicode text, with very long lines",
      "programming_language": null,
      "is_binary": false,
      "is_text": true,
      "is_archive": false,
      "is_media": false,
      "is_source": false,
      "is_script": false,
      "licenses": [
        {
          "key": "gpl-3.0",
          "score": 99.96,
          "name": "GNU General Public License 3.0",
          "short_name": "GPL 3.0",
          "category": "Copyleft",
          "is_exception": false,
          "is_unknown": 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://scancode-licensedb.aboutcode.org/gpl-3.0",
          "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-3.0.LICENSE",
          "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-3.0.yml",
          "spdx_license_key": "GPL-3.0-only",
          "spdx_url": "https://spdx.org/licenses/GPL-3.0-only",
          "start_line": 3,
          "end_line": 211,
          "matched_rule": {
            "identifier": "gpl-3.0_466.RULE",
            "license_expression": "gpl-3.0",
            "licenses": [
              "gpl-3.0"
            ],
            "referenced_filenames": [],
            "is_license_text": true,
            "is_license_notice": false,
            "is_license_reference": false,
            "is_license_tag": false,
            "is_license_intro": false,
            "has_unknown": false,
            "matcher": "3-seq",
            "rule_length": 5612,
            "matched_length": 5610,
            "match_coverage": 99.96,
            "rule_relevance": 100
          }
        }
      ],
      "license_expressions": [
        "gpl-3.0"
      ],
      "percentage_of_license_text": 99.95,
      "copyrights": [
        {
          "copyright": "Copyright (c) 2007 Free Software Foundation, Inc. <https://fsf.org/>",
          "start_line": 6,
          "end_line": 6
        }
      ],
      "holders": [
        {
          "holder": "Free Software Foundation, Inc.",
          "start_line": 6,
          "end_line": 6
        }
      ],
      "authors": [],
      "package_data": [],
      "for_packages": [],
      "files_count": 0,
      "dirs_count": 0,
      "size_count": 0,
      "scan_errors": []
    },
    {
      "path": "compatibility_test/pipeline.txt",
      "type": "file",
      "name": "pipeline.txt",
      "base_name": "pipeline",
      "extension": ".txt",
      "size": 321,
      "date": "2022-10-18",
      "sha1": "1901cb60d897ee69d8dd4aba036b4927e5b2ae41",
      "md5": "3c20a2c7f064715557f4706f5ba997ab",
      "sha256": "ce1a94fde580caa420d2a6517cf0ed4197a8a16d123f30afc6391bd86ca8ae64",
      "mime_type": "text/plain",
      "file_type": "ASCII text",
      "programming_language": null,
      "is_binary": false,
      "is_text": true,
      "is_archive": false,
      "is_media": false,
      "is_source": false,
      "is_script": false,
      "licenses": [],
      "license_expressions": [],
      "percentage_of_license_text": 0,
      "copyrights": [],
      "holders": [],
      "authors": [],
      "package_data": [],
      "for_packages": [],
      "files_count": 0,
      "dirs_count": 0,
      "size_count": 0,
      "scan_errors": []
    }
  ]
}

How To Reproduce

$ cd /path/to/compatibility_test
$ scancode --license --package --copyright --verbose --info --json-pp report-scancode.json .

System configuration

  • Linux
  • scancode-toolkit-31.2.1
  • Python 3.10.6
  • installed via pip in an otherwise clean venv

Also occurs with ORT, which uses ScanCode 30.1.0 or older (the ort-image we use in the pipeline is older then the current ORT master).

@pepper-jk pepper-jk added the bug label Oct 19, 2022
@pombredanne
Copy link
Member

@pepper-jk Hey! Thank for chiming in!

This is not a bug ... you have take a truncated version of the GPL text from SPDX that is known for modifying these texts.

You further truncated the GPL-2.0 by stripping this at the end "This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License."

This text is for the GPL 2.0 only alright.

And then you added some GPL 2.0 or later notice, this is GPL 2.0 or later correctly.

ScanCode detects the truncated GPL 2.0 text and your made up GPL 2.0 or later notice alright.

In practice folks do not copy/paste license text from the SPDX web site as they are notoriously damaged by the markup that's added. And also in practice folks do not put a GPL 2.0 or later notice at the bottom of a GPL 2.0 text. If anything this may be seen done the other way around: notice, then (full) text.

@pombredanne
Copy link
Member

@pepper-jk re:

I am currently working on copyleft license compatibility rules for ORT.

I am not sure what you are trying to achieve and it looks definitely interesting, (I would like to hear more, please elaborate) but trying to make fake license texts/notice is not going to help IMHO. You should also check out @hesa https://github.com/vinland-technology/flict that may be vaguely related.

@jens-erdmann
Copy link

You should also check out @hesa https://github.com/vinland-technology/flict that may be vaguely related.

Lets not boost his ego too much. It might cause negative effects on his surroundings.

IMHO the scoring is a bit misleading in this example. Seeing a 100.0 score for only parts of the actual license is a bit misleading.
I am aware that the test data might be flawed and therefore the issue a bit theoretical but this result had me worry a bit.

Shouldn't it affect the score if only a part of the license is matched?

Sorry if you have already explained this a gazillion times.

@pepper-jk
Copy link
Author

pepper-jk commented Oct 20, 2022

... you have take a truncated version of the GPL text from SPDX that is known for modifying these texts.
...
In practice folks do not copy/paste license text from the SPDX web site as they are notoriously damaged by the markup that's added. And also in practice folks do not put a GPL 2.0 or later notice at the bottom of a GPL 2.0 text. If anything this may be seen done the other way around: notice, then (full) text.

Thanks for letting me know. I was unaware that the website, providing the (open source) license identifiers used by a lot of license validation tools, was modifying the license texts. That seems counter productive, if you ask me. (I could confirm it though.)

If I was to add a license to a real project, I would have gone for the original source obviously. But since this was just a test, I hurried things along. I did not intend to treat your project unfairly.

However, I am not sure that this "is not a bug".

On Monday, I will take the license from gnu.org and test it again. As you know how people use the license in practice, maybe you could link to a public github project using a GPL-2.0-or-later license, I am happy to use the format and order of test they use to test scancode.

@pombredanne
Copy link
Member

If I was to add a license to a real project, I would have gone for the original source obviously. But since this was just a test, I hurried things along. I did not intend to treat your project unfairly.

No worries, I never considered this report of yours to be a problem or unfair!

On Monday, I will take the license from gnu.org and test it again. As you know how people use the license in practice, maybe you could link to a public github project using a GPL-2.0-or-later license, I am happy to use the format and order of test they use to test scancode.

Yes, that's a good option, though there again, even the FSF --that otherwise demanded a "verbatim" reproduction of the GPL text -- has published several different minor versions of the GPL-2.0 text of the years making eventually the word verbatim somewhat not as clear. See https://github.com/pombredanne/gpl-history/

As for using some sample project, any project would work out. https://github.com/pyinstaller/pyinstaller licensing is mildly interesting for its variety of licenses and use of exceptions.

pepper-jk pushed a commit to pepper-jk/compatibility_test that referenced this issue Oct 24, 2022
As stated by pimbredanne in aboutcode-org/scancode-toolkit#3128 (comment)
the license was not conform to the formatting usually used.

We adjust the format based on the license used in https://github.com/pyinstaller/pyinstaller
where appropriate.
@pepper-jk
Copy link
Author

After adjusting the gpl-2.0-or-later file as instructed, see commit above, I indeed get different score values:

- license: "GPL-2.0-only"
  location:
    path: "license-gpl-2.0-or-later.txt"
    start_line: 3
    end_line: 76
  score: 98.99
- license: "GPL-2.0-or-later"
  location:
    path: "license-gpl-2.0-or-later.txt"
    start_line: 3
    end_line: 3
  score: 100.0

So with ORT (old scancode) I get a 98.99 score for gpl-2.0-only and with the current scancode I get 99.0, see json below.

I think, this is still cutting it pretty close. The threshold to catch this problem would be 99.01. With this threshold we would most likely miss a lot of more uncommon licenses.

The other solution from user side, would be to always check if gpl-2.0-only and gpl-2.0-or-later are in the same file and create a rule based on that, that we drop gpl-2.0-only in that case.

I would propose such a rule be included in scancode, as this would be a pain to use either of the other ways.

json from scancode 31.2.1
{
  "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,
  "is_unknown": 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://scancode-licensedb.aboutcode.org/gpl-2.0-plus",
  "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.LICENSE",
  "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.yml",
  "spdx_license_key": "GPL-2.0-or-later",
  "spdx_url": "https://spdx.org/licenses/GPL-2.0-or-later",
  "start_line": 3,
  "end_line": 3,
  "matched_rule": {
    "identifier": "gpl-2.0-plus_627.RULE",
    "license_expression": "gpl-2.0-plus",
    "licenses": [
      "gpl-2.0-plus"
    ],
    "referenced_filenames": [],
    "is_license_text": false,
    "is_license_notice": true,
    "is_license_reference": false,
    "is_license_tag": false,
    "is_license_intro": false,
    "has_unknown": false,
    "matcher": "2-aho",
    "rule_length": 30,
    "matched_length": 30,
    "match_coverage": 100.0,
    "rule_relevance": 100
  }
},
{
  "key": "gpl-2.0",
  "score": 99.0,
  "name": "GNU General Public License 2.0",
  "short_name": "GPL 2.0",
  "category": "Copyleft",
  "is_exception": false,
  "is_unknown": false,
  "owner": "Free Software Foundation (FSF)",
  "homepage_url": "http://www.gnu.org/licenses/gpl-2.0.html",
  "text_url": "http://www.gnu.org/licenses/gpl-2.0.txt",
  "reference_url": "https://scancode-licensedb.aboutcode.org/gpl-2.0",
  "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.LICENSE",
  "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.yml",
  "spdx_license_key": "GPL-2.0-only",
  "spdx_url": "https://spdx.org/licenses/GPL-2.0-only",
  "start_line": 3,
  "end_line": 76,
  "matched_rule": {
    "identifier": "gpl-2.0_247.RULE",
    "license_expression": "gpl-2.0",
    "licenses": [
      "gpl-2.0"
    ],
    "referenced_filenames": [],
    "is_license_text": false,
    "is_license_notice": true,
    "is_license_reference": false,
    "is_license_tag": false,
    "is_license_intro": false,
    "has_unknown": false,
    "matcher": "3-seq",
    "rule_length": 2491,
    "matched_length": 2466,
    "match_coverage": 99.0,
    "rule_relevance": 100
  }
}

@pombredanne
Copy link
Member

@pepper-jk you may want to use this command for reviewing license scan details: scancode --license --license-text --license-text-diagnostics --yaml - <path to some file> which is what I use to review finely matches. The words not matched with be enclosed in square brackets in the matched text.

As for the report you just made, you need to provide the actual text you used as otherwise, there is nothing practical that can be done.

Note that adding new rule is welcomed... but please make sure these are for rules that exist in the wild and not for made up, synthetic texts.

@pepper-jk
Copy link
Author

As for the report you just made, you need to provide the actual text you used as otherwise, there is nothing practical that can be done.

I updated the test in the repository I provided, as can be seen above in this issue. But here is the commit: pepper-jk/compatibility_test@efda93a
I removed the gnu instructions after "END OF TERMS AND CONDITIONS" and moved the or-later to the top, as per your instructions. There should be no difference to the GPL now.

Note that adding new rule is welcomed... but please make sure these are for rules that exist in the wild and not for made up, synthetic texts.

I feel like we are having a misunderstanding. I took the instructions from you and the example you provided and create a plain gpl-2.0-later license. And there is no issue in detecting the license, but with their weight in the results and the fact that both licenses are detected, even though it is just one.

Does scancode consider the or-later in gpl-2.0-or-later to be an exception to gpl-2.0-only (aka it needs to detect two licenses)?

If the license text was "made up" it would not score 99.0 or above. And if so, this should be considered a bug as well.

So from where I stand, this is not an issue of the formatting wording of the license anymore, but an issue with the scoring or the license detection.

@pepper-jk you may want to use this command for reviewing license scan details: scancode --license --license-text --license-text-diagnostics --yaml - which is what I use to review finely matches. The words not matched with be enclosed in square brackets in the matched text.

I will try this tomorrow. But please start to consider, that this is indeed an issue.

@pepper-jk
Copy link
Author

The output of scancode --license --license-text --license-text-diagnostics --yaml gpl-2.0-or-later_diagnostics.yml license-gpl-2.0-or-later.txt:

yaml
headers:
    -   tool_name: scancode-toolkit
        tool_version: 31.2.1
        options:
            input:
                - license-gpl-2.0-or-later.txt
            --license: yes
            --license-text: yes
            --license-text-diagnostics: yes
            --yaml: gpl-2.0-or-later_diagnostics.yml
        notice: |
            Generated with ScanCode and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
            OR CONDITIONS OF ANY KIND, either express or implied. No content created from
            ScanCode should be considered or used as legal advice. Consult an Attorney
            for any legal advice.
            ScanCode is a free software code scanning tool from nexB Inc. and others.
            Visit https://github.com/nexB/scancode-toolkit/ for support and download.
        start_timestamp: '2022-10-25T123019.749741'
        end_timestamp: '2022-10-25T123023.363555'
        output_format_version: 2.0.0
        duration: '3.613826274871826'
        message:
        errors: []
        warnings: []
        extra_data:
            system_environment:
                operating_system: linux
                cpu_architecture: 64
                platform: Linux-5.15.0-50-generic-x86_64-with-glibc2.35
                platform_version: '#56-Ubuntu SMP Tue Sep 20 13:23:26 UTC 2022'
                python_version: 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0]
            spdx_license_list_version: '3.17'
            files_count: 1
files:
    -   path: license-gpl-2.0-or-later.txt
        type: file
        licenses:
            -   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: no
                is_unknown: no
                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://scancode-licensedb.aboutcode.org/gpl-2.0-plus
                scancode_text_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.LICENSE
                scancode_data_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.yml
                spdx_license_key: GPL-2.0-or-later
                spdx_url: https://spdx.org/licenses/GPL-2.0-or-later
                start_line: 3
                end_line: 3
                matched_rule:
                    identifier: gpl-2.0-plus_627.RULE
                    license_expression: gpl-2.0-plus
                    licenses:
                        - gpl-2.0-plus
                    referenced_filenames: []
                    is_license_text: no
                    is_license_notice: yes
                    is_license_reference: no
                    is_license_tag: no
                    is_license_intro: no
                    has_unknown: no
                    matcher: 2-aho
                    rule_length: 30
                    matched_length: 30
                    match_coverage: '100.0'
                    rule_relevance: 100
                matched_text: licensed under the terms of the GNU General Public License as
                    published by the Free Software Foundation; either version 2 of the License,
                    or (at your option) any later version.
            -   key: gpl-2.0
                score: '99.0'
                name: GNU General Public License 2.0
                short_name: GPL 2.0
                category: Copyleft
                is_exception: no
                is_unknown: no
                owner: Free Software Foundation (FSF)
                homepage_url: http://www.gnu.org/licenses/gpl-2.0.html
                text_url: http://www.gnu.org/licenses/gpl-2.0.txt
                reference_url: https://scancode-licensedb.aboutcode.org/gpl-2.0
                scancode_text_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.LICENSE
                scancode_data_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.yml
                spdx_license_key: GPL-2.0-only
                spdx_url: https://spdx.org/licenses/GPL-2.0-only
                start_line: 3
                end_line: 76
                matched_rule:
                    identifier: gpl-2.0_247.RULE
                    license_expression: gpl-2.0
                    licenses:
                        - gpl-2.0
                    referenced_filenames: []
                    is_license_text: no
                    is_license_notice: yes
                    is_license_reference: no
                    is_license_tag: no
                    is_license_intro: no
                    has_unknown: no
                    matcher: 3-seq
                    rule_length: 2491
                    matched_length: 2466
                    match_coverage: '99.0'
                    rule_relevance: 100
                matched_text: |
                    the GNU General Public License [as] published by the Free Software Foundation; [either] [version] [2] [of] [the] [License], [or] ([at] [your] [option]) [any] [later] [version].


                    GNU GENERAL PUBLIC LICENSE
                    Version 2, June 1991

                    Copyright (C) 1989, 1991 Free Software Foundation, Inc.
                    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

                    Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

                    Preamble

                    The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.

                    When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

                    To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

                    For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

                    We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

                    Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

                    Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

                    The precise terms and conditions for copying, distribution and modification follow.

                    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

                        0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".

                        Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
                        1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

                        You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
                        2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
                            a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
                            b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
                            c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)

                        These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

                        Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

                        In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
                        3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
                            a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
                            b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
                            c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)

                        The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

                        If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
                        4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
                        5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
                        6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
                        7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

                        If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

                        It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

                        This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
                        8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
                        9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

                        Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
                        10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

                        NO WARRANTY
                        11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
                        12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
        license_expressions:
            - gpl-2.0-plus
            - gpl-2.0
        percentage_of_license_text: '99.48'
        scan_errors: []

@pombredanne
Copy link
Member

I removed the gnu instructions after "END OF TERMS AND CONDITIONS"
and moved the or-later to the top, as per your instructions.
There should be no difference to the GPL now.

If you removed part of the text that's a difference alright, and the score that will be returned will be only partial unless there is a rule for this text variant. As a side note the GPL states that this is a violation of the GPL to truncate or remove parts of the GPL text ;) .

I had not noticed until now that pyinstaller's GPL text is truncated ( @Legorooj FYI) !

If the license text was "made up" it would not score 99.0 or above. And if so, this should be considered a bug as well.

As it happens it is matched to an otherwise truncated copy of the GPL that was seen in a Linux kernel contribution circa 6 years ago per this commit https://github.com/nexB/scancode-toolkit/blame/8b02ed69cd0293b5813715d90bf934f4d43ff66e/src/licensedcode/data/rules/gpl-2.0_247.RULE . We keep track of weird text seen in the wild and we have this variant. The detection and its score (which is BTW based on the number of aligned matching words) may not be 100% in all cases. The detection score could be treated as an indication of detection ambiguity. In this truncated example there is no ambiguity at all that the GPL applies.

Does scancode consider the or-later in gpl-2.0-or-later to be an exception to gpl-2.0-only (aka it needs to detect two licenses)?

ScanCode detects texts using diffs against it database of texts. There are no relationships between licenses: they are entirely independent things, just a bunch of texts.

Note that the GPL-2.0-or-later does not have a text that is different from the plain GPL 2.0 text at the FSF: there is only one GPL 2.0 text. What is different is an additional notice, statement or similar provided by the authors that the GPL-2.0 or any later version applies; like the one you added on top of the truncated GPL text.

@pombredanne
Copy link
Member

As it happens it is matched to an otherwise truncated copy of the GPL that was seen in a Linux kernel contribution circa 6 years ago per this commit https://github.com/nexB/scancode-toolkit/blame/8b02ed69cd0293b5813715d90bf934f4d43ff66e/src/licensedcode/data/rules/gpl-2.0_247.RULE . We keep track of weird text seen in the wild and we have this variant. The detection and its score (which is BTW based on the number of aligned matching words) may not be 100% in all cases. The detection score could be treated as an indication of detection ambiguity. In this truncated example there is no ambiguity at all that the GPL applies.

Just to clarify that since this is not ambiguous we report a high score when matched.
But since this is a truncated text, this is not considered as a proper GPL full text, but only tagged as a notice in https://github.com/nexB/scancode-toolkit/blob/ded56e9120f5fdfb9a1a0309130bb4305a66aacb/src/licensedcode/data/rules/gpl-2.0_247.yml#L2

@pepper-jk
Copy link
Author

pepper-jk commented Oct 27, 2022

ScanCode detects texts using diffs against it database of texts. There are no relationships between licenses: they are entirely independent things, just a bunch of texts.

Ok, so it just diffs against all (appropriate/possible) licenses? One by one?

Note that the GPL-2.0-or-later does not have a text that is different from the plain GPL 2.0 text at the FSF: there is only one GPL 2.0 text.

I am aware.

What is different is an additional notice, statement or similar provided by the authors that the GPL-2.0 or any later version applies; like the one you added on top of the truncated GPL text.

So my question was/is. For gpl-2.0-or-later detection, does scancode diff only against the or-later-notice or against the notice plus the full GPL 2.0 text? I would expect the later.

Further would I expect it to diff the whole license text against both gpl-2.0-or-later and then against gpl-2.0-only, as per your explanation above.

Atm it looks like, scancode just decides the gpl-2.0-only diff looked better than the gpl-2.0-or-later diff in the middle of the license text. Which makes 0 sense to me.

Please explain.

@pepper-jk
Copy link
Author

pepper-jk commented Oct 27, 2022

Just to clarify that since this is not ambiguous we report a high score when matched.
But since this is a truncated text, this is not considered as a proper GPL full text, but only tagged as a notice in

Ok, in case of truncated texts, we can still have a high score, but the finding is marked as a notice not a license somewhere in the report? This is valuable information and should be utilized by ORT and other users.

If you removed part of the text that's a difference alright, and the score that will be returned will be only partial unless there is a rule for this text variant. As a side note the GPL states that this is a violation of the GPL to truncate or remove parts of the GPL text ;) .

I had not noticed until now that pyinstaller's GPL text is truncated ( @Legorooj FYI) !

Ok, I readded the "how to apply" section from gnu.org: pepper-jk/compatibility_test@3474dd8

And I indeed get different results. GPL-2.0-only has now a score of 86.62. That is a huge difference and would make the threshold user option more usable. Of course, the best would be to detect GPL-2.0-or-later only, not both licenses.

However, now gpl-1.0-plus and lgpl-2.0-plus are detected as well, with a score of 100 each:

report-scancode.json
{
  "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,
  "is_unknown": 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://scancode-licensedb.aboutcode.org/gpl-2.0-plus",
  "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.LICENSE",
  "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.yml",
  "spdx_license_key": "GPL-2.0-or-later",
  "spdx_url": "https://spdx.org/licenses/GPL-2.0-or-later",
  "start_line": 3,
  "end_line": 3,
  "matched_rule": {
    "identifier": "gpl-2.0-plus_627.RULE",
    "license_expression": "gpl-2.0-plus",
    "licenses": [
      "gpl-2.0-plus"
    ],
    "referenced_filenames": [],
    "is_license_text": false,
    "is_license_notice": true,
    "is_license_reference": false,
    "is_license_tag": false,
    "is_license_intro": false,
    "has_unknown": false,
    "matcher": "2-aho",
    "rule_length": 30,
    "matched_length": 30,
    "match_coverage": 100.0,
    "rule_relevance": 100
  }
},
{
  "key": "gpl-2.0",
  "score": 86.62,
  "name": "GNU General Public License 2.0",
  "short_name": "GPL 2.0",
  "category": "Copyleft",
  "is_exception": false,
  "is_unknown": false,
  "owner": "Free Software Foundation (FSF)",
  "homepage_url": "http://www.gnu.org/licenses/gpl-2.0.html",
  "text_url": "http://www.gnu.org/licenses/gpl-2.0.txt",
  "reference_url": "https://scancode-licensedb.aboutcode.org/gpl-2.0",
  "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.LICENSE",
  "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.yml",
  "spdx_license_key": "GPL-2.0-only",
  "spdx_url": "https://spdx.org/licenses/GPL-2.0-only",
  "start_line": 6,
  "end_line": 84,
  "matched_rule": {
    "identifier": "gpl-2.0_1054.RULE",
    "license_expression": "gpl-2.0",
    "licenses": [
      "gpl-2.0"
    ],
    "referenced_filenames": [],
    "is_license_text": true,
    "is_license_notice": false,
    "is_license_reference": false,
    "is_license_tag": false,
    "is_license_intro": false,
    "has_unknown": false,
    "matcher": "3-seq",
    "rule_length": 2908,
    "matched_length": 2519,
    "match_coverage": 86.62,
    "rule_relevance": 100
  }
},
{
  "key": "gpl-1.0-plus",
  "score": 100.0,
  "name": "GNU General Public License 1.0 or later",
  "short_name": "GPL 1.0 or later",
  "category": "Copyleft",
  "is_exception": false,
  "is_unknown": false,
  "owner": "Free Software Foundation (FSF)",
  "homepage_url": "http://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html",
  "text_url": "http://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html",
  "reference_url": "https://scancode-licensedb.aboutcode.org/gpl-1.0-plus",
  "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-1.0-plus.LICENSE",
  "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-1.0-plus.yml",
  "spdx_license_key": "GPL-1.0-or-later",
  "spdx_url": "https://spdx.org/licenses/GPL-1.0-or-later",
  "start_line": 82,
  "end_line": 82,
  "matched_rule": {
    "identifier": "gpl_234.RULE",
    "license_expression": "gpl-1.0-plus",
    "licenses": [
      "gpl-1.0-plus"
    ],
    "referenced_filenames": [],
    "is_license_text": false,
    "is_license_notice": false,
    "is_license_reference": true,
    "is_license_tag": false,
    "is_license_intro": false,
    "has_unknown": false,
    "matcher": "2-aho",
    "rule_length": 3,
    "matched_length": 3,
    "match_coverage": 100.0,
    "rule_relevance": 100
  }
},
{
  "key": "lgpl-2.0-plus",
  "score": 100.0,
  "name": "GNU Library General Public License 2.0 or later",
  "short_name": "LGPL 2.0 or later",
  "category": "Copyleft Limited",
  "is_exception": false,
  "is_unknown": 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://scancode-licensedb.aboutcode.org/lgpl-2.0-plus",
  "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/lgpl-2.0-plus.LICENSE",
  "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/lgpl-2.0-plus.yml",
  "spdx_license_key": "LGPL-2.0-or-later",
  "spdx_url": "https://spdx.org/licenses/LGPL-2.0-or-later",
  "start_line": 86,
  "end_line": 102,
  "matched_rule": {
    "identifier": "lgpl-2.0-plus_28.RULE",
    "license_expression": "lgpl-2.0-plus",
    "licenses": [
      "lgpl-2.0-plus"
    ],
    "referenced_filenames": [],
    "is_license_text": false,
    "is_license_notice": true,
    "is_license_reference": false,
    "is_license_tag": false,
    "is_license_intro": false,
    "has_unknown": false,
    "matcher": "2-aho",
    "rule_length": 137,
    "matched_length": 137,
    "match_coverage": 100.0,
    "rule_relevance": 100
  }
}
diagnostics.yml
-   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: no
is_unknown: no
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://scancode-licensedb.aboutcode.org/gpl-2.0-plus
scancode_text_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.LICENSE
scancode_data_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.yml
spdx_license_key: GPL-2.0-or-later
spdx_url: https://spdx.org/licenses/GPL-2.0-or-later
start_line: 3
end_line: 3
matched_rule:
    identifier: gpl-2.0-plus_627.RULE
    license_expression: gpl-2.0-plus
    licenses:
        - gpl-2.0-plus
    referenced_filenames: []
    is_license_text: no
    is_license_notice: yes
    is_license_reference: no
    is_license_tag: no
    is_license_intro: no
    has_unknown: no
    matcher: 2-aho
    rule_length: 30
    matched_length: 30
    match_coverage: '100.0'
    rule_relevance: 100
matched_text: licensed under the terms of the GNU General Public License as
    published by the Free Software Foundation; either version 2 of the License,
    or (at your option) any later version.
-   key: gpl-2.0
score: '86.62'
name: GNU General Public License 2.0
short_name: GPL 2.0
category: Copyleft
is_exception: no
is_unknown: no
owner: Free Software Foundation (FSF)
homepage_url: http://www.gnu.org/licenses/gpl-2.0.html
text_url: http://www.gnu.org/licenses/gpl-2.0.txt
reference_url: https://scancode-licensedb.aboutcode.org/gpl-2.0
scancode_text_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.LICENSE
scancode_data_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.yml
spdx_license_key: GPL-2.0-only
spdx_url: https://spdx.org/licenses/GPL-2.0-only
start_line: 6
end_line: 84
matched_rule:
    identifier: gpl-2.0_1054.RULE
    license_expression: gpl-2.0
    licenses:
        - gpl-2.0
    referenced_filenames: []
    is_license_text: yes
    is_license_notice: no
    is_license_reference: no
    is_license_tag: no
    is_license_intro: no
    has_unknown: no
    matcher: 3-seq
    rule_length: 2908
    matched_length: 2519
    match_coverage: '86.62'
    rule_relevance: 100
matched_text: |
    GNU GENERAL PUBLIC LICENSE
    Version 2, June 1991
    Copyright (C) 1989, 1991 Free Software Foundation, Inc.
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
    Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
    Preamble
    The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
    When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
    To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
    For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
    We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
    Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
    Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
    The precise terms and conditions for copying, distribution and modification follow.
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
        0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
        Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
        1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
        You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
        2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
            a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
            b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
            c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
        These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
        Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
        In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
        3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
            a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
            b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
            c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
        The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
        If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
        4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
        5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
        6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
        7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
        If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
        It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
        This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
        8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
        9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
        Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
        10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
        NO WARRANTY
        11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
        12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
    END OF TERMS AND CONDITIONS
    How to Apply These Terms to Your New [Libraries]
    [If] [you] [develop] a [new] [library], [and] [you] [want] [it] [to] [be] [of] [the] [greatest] [possible] [use] [to] [the] [public], [we] [recommend] [making] [it] [free] [software] [that] everyone can redistribute and change. [You] [can] [do] [so] [by] [permitting] [redistribution] [under] [these] [terms] ([or], [alternatively], [under] [the] [terms] [of] [the] [ordinary] [General] [Public] [License]).
    [To] [apply] [these] [terms], attach the following notices to the [library]. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
-   key: gpl-1.0-plus
score: '100.0'
name: GNU General Public License 1.0 or later
short_name: GPL 1.0 or later
category: Copyleft
is_exception: no
is_unknown: no
owner: Free Software Foundation (FSF)
homepage_url: http://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html
text_url: http://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html
reference_url: https://scancode-licensedb.aboutcode.org/gpl-1.0-plus
scancode_text_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-1.0-plus.LICENSE
scancode_data_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-1.0-plus.yml
spdx_license_key: GPL-1.0-or-later
spdx_url: https://spdx.org/licenses/GPL-1.0-or-later
start_line: 82
end_line: 82
matched_rule:
    identifier: gpl_234.RULE
    license_expression: gpl-1.0-plus
    licenses:
        - gpl-1.0-plus
    referenced_filenames: []
    is_license_text: no
    is_license_notice: no
    is_license_reference: yes
    is_license_tag: no
    is_license_intro: no
    has_unknown: no
    matcher: 2-aho
    rule_length: 3
    matched_length: 3
    match_coverage: '100.0'
    rule_relevance: 100
matched_text: General Public License).
-   key: lgpl-2.0-plus
score: '100.0'
name: GNU Library General Public License 2.0 or later
short_name: LGPL 2.0 or later
category: Copyleft Limited
is_exception: no
is_unknown: no
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://scancode-licensedb.aboutcode.org/lgpl-2.0-plus
scancode_text_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/lgpl-2.0-plus.LICENSE
scancode_data_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/lgpl-2.0-plus.yml
spdx_license_key: LGPL-2.0-or-later
spdx_url: https://spdx.org/licenses/LGPL-2.0-or-later
start_line: 86
end_line: 102
matched_rule:
    identifier: lgpl-2.0-plus_28.RULE
    license_expression: lgpl-2.0-plus
    licenses:
        - lgpl-2.0-plus
    referenced_filenames: []
    is_license_text: no
    is_license_notice: yes
    is_license_reference: no
    is_license_tag: no
    is_license_intro: no
    has_unknown: no
    matcher: 2-aho
    rule_length: 137
    matched_length: 137
    match_coverage: '100.0'
    rule_relevance: 100
matched_text: |
    one line to give the library's name and an idea of what it does.
    Copyright (C) year  name of author
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.
    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the
    Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
    Boston, MA  02110-1301, USA.

@pombredanne
Copy link
Member

Ok, I readded the "how to apply" section from gnu.org: pepper-jk/compatibility_test@3474dd8

And I indeed get different results. GPL-2.0-only has now a score of 86.62. That is a huge difference and would make the threshold user option more usable. Of course, the best would be to detect GPL-2.0-or-later only, not both licenses.
However, now gpl-1.0-plus and lgpl-2.0-plus are detected as well, with a score of 100 each:

In pepper-jk/compatibility_test@3474dd8 , you now mixed parts of the LGPL 2.0 https://www.gnu.org/licenses/old-licenses/lgpl-2.0.txt bottom from this lines range https://gist.github.com/pombredanne/95ecbb5118e3bec8db343a0080947037#file-lgpl-2-0-txt-L439-file-lgpl-2-0-txt-L481 with a top of the GPL 2.0 from this lines range https://gist.github.com/pombredanne/bd3ce201c53fa895f108ea4ee45dfb18#file-gpl-2-0-txt-L1-L280 which leads to interesting and creative detections for sure none of which being fully conclusive as they should. Again made up, synthetic texts are not something we care to detect exactly. We do detect them as weird because that's what they are. In earnest, I find the detections you reported with this franken license as pretty accurate otherwise.

I really suggest that you try reusing as-is existing texts seen in actual open source projects and stop trying to make up frankenstein-like license notices.

Of course, the best would be to detect GPL-2.0-or-later only, not both licenses.

I welcome a PR with new rules combining both that correspond to actual seen-in-the-wild cases referenced by a URL. I will reject made up license texts and notices.

@pepper-jk
Copy link
Author

In pepper-jk/compatibility_test@3474dd8 , you now mixed parts of the LGPL 2.0

Oh. Thanks. I must have clicked on the wrong license, when retrieving this. I must admit, that I did this in haste today. Sorry about that mistake.

I have removed the LGPL license text. And to make sure the rest of the GPL is not "made up", I have replaced the whole license with the license found here: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
pepper-jk/compatibility_test@d65fec9

So for the final results:
gpl-2.0-or-later and gpl-2.0-only are both detected with a score of 100. So the issue persists, even with a correct and complete gpl-2.0-or-later licenses.

report-scancode.json
{
  "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,
  "is_unknown": 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://scancode-licensedb.aboutcode.org/gpl-2.0-plus",
  "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.LICENSE",
  "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.yml",
  "spdx_license_key": "GPL-2.0-or-later",
  "spdx_url": "https://spdx.org/licenses/GPL-2.0-or-later",
  "start_line": 3,
  "end_line": 3,
  "matched_rule": {
    "identifier": "gpl-2.0-plus_627.RULE",
    "license_expression": "gpl-2.0-plus",
    "licenses": [
      "gpl-2.0-plus"
    ],
    "referenced_filenames": [],
    "is_license_text": false,
    "is_license_notice": true,
    "is_license_reference": false,
    "is_license_tag": false,
    "is_license_intro": false,
    "has_unknown": false,
    "matcher": "2-aho",
    "rule_length": 30,
    "matched_length": 30,
    "match_coverage": 100.0,
    "rule_relevance": 100
  }
},
{
  "key": "gpl-2.0",
  "score": 100.0,
  "name": "GNU General Public License 2.0",
  "short_name": "GPL 2.0",
  "category": "Copyleft",
  "is_exception": false,
  "is_unknown": false,
  "owner": "Free Software Foundation (FSF)",
  "homepage_url": "http://www.gnu.org/licenses/gpl-2.0.html",
  "text_url": "http://www.gnu.org/licenses/gpl-2.0.txt",
  "reference_url": "https://scancode-licensedb.aboutcode.org/gpl-2.0",
  "scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.LICENSE",
  "scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.yml",
  "spdx_license_key": "GPL-2.0-only",
  "spdx_url": "https://spdx.org/licenses/GPL-2.0-only",
  "start_line": 6,
  "end_line": 138,
  "matched_rule": {
    "identifier": "gpl-2.0.SPDX.RULE",
    "license_expression": "gpl-2.0",
    "licenses": [
      "gpl-2.0"
    ],
    "referenced_filenames": [],
    "is_license_text": true,
    "is_license_notice": false,
    "is_license_reference": false,
    "is_license_tag": false,
    "is_license_intro": false,
    "has_unknown": false,
    "matcher": "2-aho",
    "rule_length": 2927,
    "matched_length": 2927,
    "match_coverage": 100.0,
    "rule_relevance": 100
  }
}
diagnostics.yml
            -   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: no
                is_unknown: no
                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://scancode-licensedb.aboutcode.org/gpl-2.0-plus
                scancode_text_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.LICENSE
                scancode_data_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.yml
                spdx_license_key: GPL-2.0-or-later
                spdx_url: https://spdx.org/licenses/GPL-2.0-or-later
                start_line: 3
                end_line: 3
                matched_rule:
                    identifier: gpl-2.0-plus_627.RULE
                    license_expression: gpl-2.0-plus
                    licenses:
                        - gpl-2.0-plus
                    referenced_filenames: []
                    is_license_text: no
                    is_license_notice: yes
                    is_license_reference: no
                    is_license_tag: no
                    is_license_intro: no
                    has_unknown: no
                    matcher: 2-aho
                    rule_length: 30
                    matched_length: 30
                    match_coverage: '100.0'
                    rule_relevance: 100
                matched_text: licensed under the terms of the GNU General Public License as
                    published by the Free Software Foundation; either version 2 of the License,
                    or (at your option) any later version.
            -   key: gpl-2.0
                score: '100.0'
                name: GNU General Public License 2.0
                short_name: GPL 2.0
                category: Copyleft
                is_exception: no
                is_unknown: no
                owner: Free Software Foundation (FSF)
                homepage_url: http://www.gnu.org/licenses/gpl-2.0.html
                text_url: http://www.gnu.org/licenses/gpl-2.0.txt
                reference_url: https://scancode-licensedb.aboutcode.org/gpl-2.0
                scancode_text_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.LICENSE
                scancode_data_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.yml
                spdx_license_key: GPL-2.0-only
                spdx_url: https://spdx.org/licenses/GPL-2.0-only
                start_line: 6
                end_line: 138
                matched_rule:
                    identifier: gpl-2.0.SPDX.RULE
                    license_expression: gpl-2.0
                    licenses:
                        - gpl-2.0
                    referenced_filenames: []
                    is_license_text: yes
                    is_license_notice: no
                    is_license_reference: no
                    is_license_tag: no
                    is_license_intro: no
                    has_unknown: no
                    matcher: 2-aho
                    rule_length: 2927
                    matched_length: 2927
                    match_coverage: '100.0'
                    rule_relevance: 100
                matched_text: |
                    GNU GENERAL PUBLIC LICENSE

                    Version 2, June 1991

                    Copyright (C) 1989, 1991 Free Software Foundation, Inc.
                    51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA

                    Everyone is permitted to copy and distribute verbatim copies
                    of this license document, but changing it is not allowed.

                    Preamble

                    The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.

                    When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

                    To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

                    For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

                    We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

                    Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

                    Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

                    The precise terms and conditions for copying, distribution and modification follow.
                    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

                    0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".

                    Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

                    1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

                    You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

                    2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

                        a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
                        b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
                        c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)

                    These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

                    Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

                    In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

                    3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

                        a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
                        b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
                        c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)

                    The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

                    If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

                    4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

                    5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

                    6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

                    7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

                    If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

                    It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

                    This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

                    8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

                    9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

                    Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

                    10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

                    NO WARRANTY

                    11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

                    12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
                    END OF TERMS AND CONDITIONS
                    How to Apply These Terms to Your New Programs

                    If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

                    To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.

                    one line to give the program's name and an idea of what it does.
                    Copyright (C) yyyy  name of author

                    This program is free software; you can redistribute it and/or
                    modify it under the terms of the GNU General Public License
                    as published by the Free Software Foundation; either version 2
                    of the License, or (at your option) any later version.

                    This program is distributed in the hope that it will be useful,
                    but WITHOUT ANY WARRANTY; without even the implied warranty of
                    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                    GNU General Public License for more details.

                    You should have received a copy of the GNU General Public License
                    along with this program; if not, write to the Free Software
                    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

                    Also add information on how to contact you by electronic and paper mail.

                    If the program is interactive, make it output a short notice like this when it starts in an interactive mode:

                    Gnomovision version 69, Copyright (C) year name of author
                    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
                    type `show w'.  This is free software, and you are welcome
                    to redistribute it under certain conditions; type `show c'
                    for details.

                    The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.

                    You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:

                    Yoyodyne, Inc., hereby disclaims all copyright
                    interest in the program `Gnomovision'
                    (which makes passes at compilers) written
                    by James Hacker.

                    signature of Ty Coon, 1 April 1989
                    Ty Coon, President of Vice

                    This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.

@pepper-jk
Copy link
Author

pepper-jk commented Oct 27, 2022

I welcome a PR with new rules combining both that correspond to actual seen-in-the-wild cases referenced by a URL.

Before I could attempt writing a PR, I would need to know the answer to the questions I voiced above: #3128 (comment)

I will reject made up license texts and notices.

I do not see the point in looking for a real world project. I have already shown (#3128 (comment)) that the pyinstaller GPL produced the same result, as this synthetic license. And I obviously can not use the whole license notice of pyinstaller for a test, as it contains several GPL expections and an apache license attached, which would falsify the results.

The only way to test this is bug is with a "synthetic" GPL license, as it is supposed to be written. I have provided such a license and a scan now (#3128 (comment)).

The only other way would be to look for a project that only uses this license and nothing else. I am not aware of a project that uses GPL-2.0-or-later and I will not waste my time looking for one, when I have a perfectly reproducible "synthetic" benchmark for this bug.

@pombredanne
Copy link
Member

@pepper-jk @jens-erdmann if you are interested to learn how the license matching process works please see https://github.com/nexB/scancode-toolkit/blob/develop/src/licensedcode/README.rst
There are also major reworks under way in #2961 described in #2878

@pepper-jk re:

I do not see the point in looking for a real world project.
[...]
The only way to test this is bug is with a "synthetic" GPL license, as it is supposed to be written.

I am at loss to help there. We do not do theoretical scanning as someone may suppose, but only practical scanning based on actually observed practices.

If you think you can find a way to conclude automatically that the notice at https://github.com/pyinstaller/pyinstaller/blob/93446fffd58ae33992031902607daa6a0ffc1996/COPYING.txt#L11-L13 and the license text fragment at https://github.com/pyinstaller/pyinstaller/blob/93446fffd58ae33992031902607daa6a0ffc1996/COPYING.txt#L110-L396 are in fact a single license statement, I will welcome a solution by all means.

We have new ways in #2961 to combine multiple matches in derived larger detections and that could be a place to do this this kind of combinations, but then again it would have to be based on actual observed-in-the-wild, common enough cases to be worth the effort.

[...] I will not waste my time looking for one

Fair enough. I will not waste my time trying to help then.

@pepper-jk
Copy link
Author

I am at loss to help there. We do not do theoretical scanning as someone may suppose, but only practical scanning based on actually observed practices.

I do not understand what you assume the "observed practice" is, asides from the practice you described as "putting the or-later notice in the front" and "not truncating the license" (one of which we already observed in the wild).

  1. I used the license text from spdx, which is a will known source and I assumed you matched against. The license was out of order und truncated. [synthetic]
  2. Then I used the format of pyinstaller, which you pointed me to, and is actual observed-in-the-wild, but which had a truncated license as well. [from the wild]
  3. I take the original license from gnu.org, apply the "observed practice" and put the or-later notice in the beginning, like pyinstaller (contrary to the spdx version). [official source + "best practice"]

Over all three scans, we have seen they get very similar results, showing the same issue. The evidence is sufficient.

If you think you can find a way to conclude automatically that the notice at pyinstaller/pyinstaller@93446ff/COPYING.txt#L11-L13 and the license text fragment at pyinstaller/pyinstaller@93446ff/COPYING.txt#L110-L396 are in fact a single license statement, I will welcome a solution by all means.

We have new ways in #2961 to combine multiple matches in derived larger detections and that could be a place to do this this kind of combinations, but then again it would have to be based on actual observed-in-the-wild, common enough cases to be worth the effort.

I might look into this, if I find the time.

@pepper-jk @jens-erdmann if you are interested to learn how the license matching process works please see develop/src/licensedcode/README.rst
There are also major reworks under way in #2961 described in #2878

Thanks for the information.

@pepper-jk
Copy link
Author

@pombredanne I'd like to apologize for my behavior last week. I grew frustrated while looking into the issue. But I should not have let that influence the discussion. I'll try to do better in the future.

Could you let me know if the evidence I provided above is sufficient to submit a pull request?

In case it is not, would the following tests be sufficient:

  1. scanning the pyinstaller license as is (including the truncated GPL-2.0-or-later)
  2. scanning the pyinstaller license after adding the missing GPL text

@pombredanne
Copy link
Member

@pepper-jk Thanks! but no worries, I am cool!
Your approach seems sensible. Please submit the PR and I can best comment it there.

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

No branches or pull requests

3 participants