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

オープン
#5,454 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
2.7k
フォーク
871
平均マージ
1日 10時間
マージ済み PR(30日)
3

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

aboutcode-org/scancode-toolkit のほかの issue

aboutcode-org/scancode-toolkit の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。