Misleading license finding in PKG-INFO in case of --package option
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 2.7k
- Forks
- 871
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 3
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aboutcode-org/scancode-toolkit
-
yarn.lock v1 with a scoped alias of an unscoped package yields no packages and no errorPossibly taken @Shubham-dev-stack claimed this 6 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
aboutcode-org/scancode-toolkit#5466 ·
Maintainers usually reply within 2 days
-
package-lock.json dependencies report file_references as a list inside a listPossibly taken @Anbarasu2410 claimed this 9 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aboutcode-org/scancode-toolkit#5449 · 4 comments ·
Maintainers usually reply within 2 days
-
scancode aborts when encountering a broken RPM archivePossibly taken @Ashutosh-Panda2004 claimed this 14 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
aboutcode-org/scancode-toolkit#5407 · 3 comments ·
Maintainers usually reply within 2 days
-
Four silent bugs: IsRequiredPhrase.license_expression returns None, find_in_path ignores later PATH changes, duplicate dict keys override license mappingsPossibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 2/5 Half a day Newbie friendliness 65/100
aboutcode-org/scancode-toolkit#5405 · 1 comment ·
Maintainers usually reply within 2 days
-
parse_maintainer_name_email returns empty name and wrong email when string has "@" but no angle bracketsPossibly taken @RohitSutar1823 claimed this 14 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
aboutcode-org/scancode-toolkit#5402 ·
Maintainers usually reply within 2 days
All issues in aboutcode-org/scancode-toolkit
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mohanraj00/entelos#200 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
sweep
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
bketelsen/truenas-mcp#77 ·
Maintainers usually reply within 1 day
-
Console writes URL credentials to the local log, though AGENTS.md says secrets never reach diskOpen
Difficulty 1/5 Under an hour Newbie friendliness 86/100
sandbox-quantum/switch#2163 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
openedx/xblock-lti-consumer#765 ·
Maintainers usually reply within 1 day