SPDX IDs that differ only by case are treated as duplicates

未关闭
#463 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@soimkim 已经在做这个了。

开始于 2026年11月19日。

  • #464 来自 @soimkim —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
58/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java
领域
backend, databases

调研方向

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

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

主要语言
Java
星标
72
派生
45
平均合并
1 天 13 小时
30 天内合并 PR
10

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

spdx/Spdx-Java-Library 的其他 Issue

查看 spdx/Spdx-Java-Library 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。