SPDX IDs that differ only by case are treated as duplicates
維護者通常 1 天內回覆
評估
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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
- File SPDX identifier (2.3.1, clause 8.2): https://spdx.github.io/spdx-spec/v2.3.1/file-information/#82-file-spdx-identifier-field
- Package SPDX identifier (2.3.1, clause 7.2): https://spdx.github.io/spdx-spec/v2.3.1/package-information/#72-package-spdx-identifier-field
- Element URI form,
[document namespace]#[SPDX identifier]: same clauses, RDF examples - JSON schema
SPDXIDpattern: https://github.com/spdx/spdx-spec/blob/v2.3.1/schemas/spdx-schema.json
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), thenDuplicateSpdxIdExceptionwhen the key is already presentgetItem,delete, andgetCaseSensitiveIdalso look uptoLowerCase()
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.oggfor/system/product/media/audio/notifications/Arcturus.oggSPDXRef-system-product-media-audio-notifications-arcturus.oggfor/system/product/media/audio/notifications/arcturus.ogg
Expected behavior
IDs that differ only by case are stored and resolved as different elements.
Code
- 主要語言
- Java
- 星號
- 72
- 分支
- 45
- 平均合併
- 1 天 13 小時
- 30 天內合併 PR
- 10
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
spdx/Spdx-Java-Library 的其他 Issue
-
question
難度 5/5 一週以上 新手友好度 30/100
spdx/Spdx-Java-Library#449 ·
維護者通常 1 天內回覆
-
question
難度 5/5 一週以上 新手友好度 30/100
spdx/Spdx-Java-Library#398 · 1 個 reaction ·
維護者通常 1 天內回覆
-
wontfix
難度 3/5 1-2 天 新手友好度 45/100
spdx/Spdx-Java-Library#393 · 2 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
matching
難度 5/5 一週以上 新手友好度 35/100
spdx/Spdx-Java-Library#392 · 4 則留言 ·
維護者通常 1 天內回覆
-
enhancement
難度 5/5 一週以上 新手友好度 30/100
spdx/Spdx-Java-Library#390 · 11 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
查看 spdx/Spdx-Java-Library 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
-
CI: LFC/ANTLR caches still use the old lfc/ paths, so the ANTLR jar is downloaded on every run可能已有人在做 @NicoBiernat 今天認領。 未關閉bug CI
難度 2/5 1-3 小時 新手友好度 84/100
lf-lang/reactor-uc#443 ·
維護者通常 4 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
Card-Forge/forge#13128 ·
維護者通常 1 天內回覆
-
client documentation
難度 1/5 1-3 小時 新手友好度 86/100
ClickHouse/clickhouse-java#3469 ·
維護者通常 1 天內回覆
-
bug good first issue help wanted
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆