SPDX IDs that differ only by case are treated as duplicates

Đang mở
#463 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@soimkim đang làm issue này rồi.

Từ ngày 19/11/2026.

  • #464 của @soimkim — đang mở

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
58/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
backend, databases

Hướng nghiên cứu

Start with src/main/java/org/spdx/storage/simple/InMemSpdxStore.java and trace how exists, create, getItem, delete, and getCaseSensitiveId form and look up map keys. Check the tests for InMemSpdxStore and add coverage for two SPDX IDs that differ only by case. Done means both IDs can be stored and resolved independently without a duplicate exception.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

InMemSpdxStore stores each element under a lowercased object URI. Two SPDX IDs that differ only by letter case therefore collide, and create throws DuplicateSpdxIdException.

SPDX 2.3.1 treats those IDs as different. An SPDXID is SPDXRef- plus a unique idstring of letters, numbers, ., and -. The specification does not fold case. SPDXRef-Arcturus.ogg and SPDXRef-arcturus.ogg are two identifiers.

The element URI is [document namespace]#[SPDX identifier]. URI fragments are case-sensitive, so those two IDs are also different element URIs.

The 2.3.1 JSON schema allows both cases in one pattern: ^SPDXRef-[a-zA-Z0-9.-]+$.

Spec

Actual behavior

InMemSpdxStore in v2.0.5 uses the lowercased URI as the map key:

  • exists: typedValueMap.containsKey(objectUri.toLowerCase())
  • create: typedValueMap.putIfAbsent(typedValue.getObjectUri().toLowerCase(), value), then DuplicateSpdxIdException when the key is already present
  • getItem, delete, and getCaseSensitiveId also look up toLowerCase()

v1.1.10 does the same with id.toLowerCase(). Loading a document that contains both IDs fails there with:

org.spdx.library.model.DuplicateSpdxIdException: ID SPDXRef-system-product-media-audio-notifications-arcturus.ogg already exists.

That document has two different files:

  • SPDXRef-system-product-media-audio-notifications-Arcturus.ogg for /system/product/media/audio/notifications/Arcturus.ogg
  • SPDXRef-system-product-media-audio-notifications-arcturus.ogg for /system/product/media/audio/notifications/arcturus.ogg

Expected behavior

IDs that differ only by case are stored and resolved as different elements.

Code

https://github.com/spdx/Spdx-Java-Library/blob/v2.0.5/src/main/java/org/spdx/storage/simple/InMemSpdxStore.java

Ngôn ngữ chính
Java
Star
72
Fork
45
Merge trung bình
1 ngày 13 giờ
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của spdx/Spdx-Java-Library

Tất cả issue của spdx/Spdx-Java-Library

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.