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

Ouverte
#5,454 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
55/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
python
Domaine
backend

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Python
Étoiles
2.7k
Forks
871
Merge moyen
1 j 10 h
PR mergées (30 j)
3

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de aboutcode-org/scancode-toolkit

Toutes les issues de aboutcode-org/scancode-toolkit

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.