Duplicate LGPL key in rubygems LICENSES_MAPPING makes one mapping unreachable
Maintainer thường phản hồi trong vòng 3 ngày
@Daksha1611 đang làm issue này rồi.
Từ ngày 11/9/2026.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 88/100
Hướng nghiên cứu
Bắt đầu trong src/packagedcode/rubygems.py tại LICENSES_MAPPING, khoảng dòng 679-680, nơi 'LGPL' xuất hiện hai lần. Xác nhận mapping đơn nào cần được giữ lại và xóa mục key trùng lặp. Chạy đoạn snippet kiểm tra key trùng lặp bằng AST được cung cấp (hoặc tương đương) để đảm bảo không còn key 'LGPL' trùng lặp, sau đó kiểm tra LICENSES_MAPPING['LGPL'] sau khi import để xác nhận giá trị đã được resolve theo đúng dự kiến.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 2.7k
- Fork
- 831
- Merge trung bình
- 3 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aboutcode-org/scancode-toolkit
-
bug: Unreachable JSON extension and format validation in validate_input_pathCó thể đã có người làm @0Cymantek0 đã nhận 18 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
aboutcode-org/scancode-toolkit#5351 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
CycloneDX output: metadata.properties[].value emits JSON array instead of stringCó thể đã có người làm @0Cymantek0 đã nhận 17 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
aboutcode-org/scancode-toolkit#5349 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Duplicate 'COPYLEFT' entries in legal file classification names in legal.py and classify.pyCó thể đã có người làm @Pradeepbeleri đã nhận 45 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
aboutcode-org/scancode-toolkit#5319 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Duplicate autogen.sh entry in commoncode default ignoresCó thể đã có người làm @Daksha1611 đã nhận 47 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
aboutcode-org/scancode-toolkit#5316 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Duplicate keys in alpine DECLARED_TO_SPDX silently discard two license mappingsCó thể đã có người làm @Daksha1611 đã nhận 47 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
aboutcode-org/scancode-toolkit#5312 ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của aboutcode-org/scancode-toolkit
Issue tương tự
-
Context/namespace resources fail in-cluster: "Invalid kube-config file. No configuration found."Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
bug documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
awslabs/visual-asset-management-system#880 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
netbox status: needs owner type: documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
netbox-community/netbox#23533 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
app: scripts status: backlog type: documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
netbox-community/netbox-scripts#68 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
marin-community/marin#10765 ·
Maintainer thường phản hồi trong vòng 1 ngày