Skip to content

Unexpected missing spdx expression in license detection #4015

Closed
@alexzurbonsen

Description

@alexzurbonsen

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions