Misleading license finding in PKG-INFO in case of --package option

Aperta
#5,454 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Start by tracing how the --package option processes PKG-INFO and how license findings get their source line; the issue gives a reproducer and sample input but names no files or tests. Run the listed ScanCode command against the supplied PKG-INFO content and inspect the finding at line 1. Done means the reported license match points to text that actually contains the license, with a regression check for this case.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
Description

when the --package option is used in a Python package the ScanCode results show a finding in the 1st line of "PKG-INFO", however the first line does not contain any text about licenses.

How To Reproduce
pip download openai==2.41.1 --no-binary :all: --no-deps -d ./oai-sdist
tar -xzf ./oai-sdist/openai-2.41.1.tar.gz openai-2.41.1/PKG-INFO
scancode --license --copyright --license-score 90 --license-text --package --processes 4 --verbose --json-pp result.json openai-2.41.1/PKG-INFO

The result will contain

            {
              "license_expression": "apache-2.0",
              "license_expression_spdx": "Apache-2.0",
              "from_file": "PKG-INFO",
              "start_line": 1,
              "end_line": 1,
              "matcher": "1-hash",
              "score": 100.0,
              "matched_length": 3,
              "match_coverage": 100.0,
              "rule_relevance": 100,
              "rule_identifier": "spdx_license_id_apache-2.0_for_apache-2.0.RULE",
              "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/spdx_license_id_apache-2.0_for_apache-2.0.RULE",
              "matched_text": "Apache-2.0"
            }

Even if the PKG-INFO content is

Metadata-Version: 2.3
Name: openai
Version: 2.41.1
Summary: The official Python library for the openai API
Project-URL: Homepage, https://github.com/openai/openai-python
Project-URL: Repository, https://github.com/openai/openai-python
Author-email: OpenAI <[email protected]>
License: Apache-2.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: MacOS

System configuration
    {
      "tool_name": "scancode-toolkit",
      "tool_version": "32.3.3",
      "options": {
        "input": [
          "openai-2.41.1/PKG-INFO"
        ],
        "--copyright": true,
        "--json-pp": "result.json",
        "--license": true,
        "--license-score": "90",
        "--license-text": true,
        "--package": true,
        "--processes": "4",
        "--verbose": true
      },
      "output_format_version": "4.0.0",
      "duration": 3.8503596782684326,
      "extra_data": {
        "system_environment": {
          "operating_system": "linux",
          "cpu_architecture": "64",
          "platform": "Linux-6.18.33.2-microsoft-standard-WSL2-x86_64-with-glibc2.43",
          "platform_version": "#1 SMP PREEMPT_DYNAMIC Thu Jun 18 21:54:43 UTC 2026",
          "python_version": "3.12.10 (main, Jul 28 2026, 10:06:18) [GCC 15.2.0]"
        },
        "spdx_license_list_version": "3.26",
        "files_count": 1
      }
    }

I've installed ScanCode with pip from a local source tree.

Lingua principale
Python
Stelle
2.7k
Fork
871
Merge medio
1g 10h
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aboutcode-org/scancode-toolkit

Tutte le issue di aboutcode-org/scancode-toolkit

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.