Duplicate LGPL key in rubygems LICENSES_MAPPING makes one mapping unreachable
メンテナーはふだん 3 日以内に返信
@Daksha1611 がすでに取り組んでいます。
2026年9月11日 から。
評価
調査の方向性
src/packagedcode/rubygems.py の LICENSES_MAPPING を、'LGPL' が 2 回現れる 679~680 行付近から確認します。どちらの単一のマッピングを残すべきかを確認し、重複したキーのエントリを削除します。重複キー用に提供されている AST チェックのスニペット(または同等のもの)を実行して、重複した 'LGPL' キーが残っていないことを確認し、その後 import 後に LICENSES_MAPPING['LGPL'] を確認して、意図した解決値であることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Description
LICENSES_MAPPING in src/packagedcode/rubygems.py defines 'LGPL' twice, on two consecutive lines (679-680):
'LGPL': 'lgpl',
'LGPL': 'lgpl-2.0-plus',
Both are entries of the same dict literal, so the first is discarded and every gem declaring a bare LGPL resolves to lgpl-2.0-plus.
That is worth a second look on its own: an unversioned LGPL declaration does not state a version, and lgpl-2.0-plus asserts one. The generic 'LGPL': 'lgpl' line immediately above looks like the mapping intended for the unversioned case, and the table already has separate explicit entries for the versioned spellings. Either way, which one applies is currently decided by line order rather than intent, and the unreachable line is misleading to read.
How To Reproduce
import ast, collections
src = open('src/packagedcode/rubygems.py').read()
for node in ast.walk(ast.parse(src)):
if isinstance(node, ast.Dict):
counts = collections.Counter(
k.value for k in node.keys
if isinstance(k, ast.Constant) and isinstance(k.value, str)
)
for key, n in counts.items():
if n > 1:
print(f'line {node.lineno}: duplicate key {key!r} x{n}')
line 658: duplicate key 'LGPL' x2
And the effective value:
>>> from packagedcode.rubygems import LICENSES_MAPPING
>>> LICENSES_MAPPING['LGPL']
'lgpl-2.0-plus'
The 'lgpl' entry is unreachable.
Suggested fix
Remove one of the two lines. I have opened a PR that drops the unreachable one and keeps the current result, so nothing changes at runtime. If a bare LGPL should instead stay unversioned as lgpl, that is a one-word change on top and I am happy to make it.
System configuration
- What OS are you running on? Linux (x86_64)
- What version of scancode-toolkit was used? 33.0.0rc1,
developat 5ebebf2 - What installation method was used to install/run scancode? source checkout
- Python version: 3.x
- 主要言語
- Python
- スター
- 2.7k
- フォーク
- 831
- 平均マージ
- 3日 4時間
- マージ済み PR(30日)
- 7
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
aboutcode-org/scancode-toolkit のほかの issue
-
bug: Unreachable JSON extension and format validation in validate_input_path対応中かも @0Cymantek0 が 18 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
aboutcode-org/scancode-toolkit#5351 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
CycloneDX output: metadata.properties[].value emits JSON array instead of string対応中かも @0Cymantek0 が 18 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
aboutcode-org/scancode-toolkit#5349 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
Duplicate 'COPYLEFT' entries in legal file classification names in legal.py and classify.py対応中かも @Pradeepbeleri が 45 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
aboutcode-org/scancode-toolkit#5319 · コメント 2 件 ·
メンテナーはふだん 3 日以内に返信
-
Duplicate autogen.sh entry in commoncode default ignores対応中かも @Daksha1611 が 48 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
aboutcode-org/scancode-toolkit#5316 ·
メンテナーはふだん 3 日以内に返信
-
Duplicate keys in alpine DECLARED_TO_SPDX silently discard two license mappings対応中かも @Daksha1611 が 48 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
aboutcode-org/scancode-toolkit#5312 ·
メンテナーはふだん 3 日以内に返信
aboutcode-org/scancode-toolkit の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
Validate finite output clamping limits in StepPredictor.prepare_clamping_params to prevent silent NaN/Inf propagation対応中かも @muskan-creates352 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
mllam/neural-lam#848 ·
メンテナーはふだん 2 日以内に返信
-
infra
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
fab-geocommuns/RNB-coeur#1166 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
deepspeedai/DeepSpeed#8951 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aws/context-ontology-accelerator#343 ·
メンテナーはふだん 1 日以内に返信