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

Unexpected missing spdx expression in license detection #4015

Open
alexzurbonsen opened this issue Dec 12, 2024 · 1 comment · May be fixed by #4023
Open

Unexpected missing spdx expression in license detection #4015

alexzurbonsen opened this issue Dec 12, 2024 · 1 comment · May be fixed by #4023
Assignees
Labels

Comments

@alexzurbonsen
Copy link
Contributor

Description

In some cases the license_expression_spdx of a license_detection is null even though the reference_match has a non-null expression.

Example:

"license_detections": [
        {
            "identifier": "mpl_2_0-31c7f2f0-eb53-75b7-e843-a9ef4eb4ddf4",
            "license_expression": "mpl-2.0",
            "license_expression_spdx": null,
            "detection_count": 1,
            "reference_matches": [
                {
                    "license_expression": "mpl-2.0",
                    "license_expression_spdx": "MPL-2.0",
                    "from_file": "Amd.h",
                    "start_line": 17,
                    "end_line": 18,
                    "matcher": "3-seq",
                    "score": 50.0,
                    "matched_length": 8,
                    "match_coverage": 50.0,
                    "rule_relevance": 100,
                    "rule_identifier": "mpl-2.0_97.RULE",
                    "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mpl-2.0_97.RULE"
                }
            ]
        },
        {
            "identifier": "mpl_2_0-d0113b18-ff50-a2fd-17f7-9227082156a7",
            "license_expression": "mpl-2.0",
            "license_expression_spdx": "MPL-2.0",
            "detection_count": 1,
            "reference_matches": [
                {
                    "license_expression": "mpl-2.0",
                    "license_expression_spdx": "MPL-2.0",
                    "from_file": "Amd.h",
                    "start_line": 6,
                    "end_line": 8,
                    "matcher": "2-aho",
                    "score": 100.0,
                    "matched_length": 39,
                    "match_coverage": 100.0,
                    "rule_relevance": 100,
                    "rule_identifier": "mpl-2.0_3.RULE",
                    "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mpl-2.0_3.RULE"
                }
            ]
        }
    ],

I would have expected both license detections to have a a non-null spdx license expression.

How To Reproduce

Download https://gitlab.com/libeigen/eigen/-/blob/3.4/Eigen/src/OrderingMethods/Amd.h?ref_type=heads

Run

scancode -l <path/to/file>/Amd.h  --json scancode_null_expression.json

on master or with v32.3.0.

scancode_null_expression.json

System configuration

For bug reports, it really helps us to know:

  • What OS are you running on? Mac
  • What version of scancode-toolkit was used to generate the scan file? 32.3.0
  • What installation method was used to install/run scancode? pip
@alexzurbonsen alexzurbonsen changed the title Missing spdx expression in license detection Unexpected missing spdx expression in license detection Dec 12, 2024
@AyanSinhaMahapatra
Copy link
Member

@alexzurbonsen Thanks for the report, this is a bug indeed.

@AyanSinhaMahapatra AyanSinhaMahapatra self-assigned this Dec 13, 2024
@alexzurbonsen alexzurbonsen linked a pull request Dec 16, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants