SPDX IDs that differ only by case are treated as duplicates
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 58/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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
- Vorherrschende Sprache
- Java
- Sterne
- 72
- Forks
- 45
- Ø Merge
- 1 T. 13 Std.
- Gemergte PRs (30 T.)
- 10
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus spdx/Spdx-Java-Library
-
question
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
spdx/Spdx-Java-Library#449 ·
Maintainer antworten meist innerhalb von 1 Tag
-
question
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
spdx/Spdx-Java-Library#398 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
wontfix
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
spdx/Spdx-Java-Library#393 · 2 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
matching
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
spdx/Spdx-Java-Library#392 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
spdx/Spdx-Java-Library#390 · 11 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in spdx/Spdx-Java-Library
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
-
CI: LFC/ANTLR caches still use the old lfc/ paths, so the ANTLR jar is downloaded on every runEvtl. vergeben @NicoBiernat hat das heute übernommen. Offenbug CI
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
lf-lang/reactor-uc#443 ·
Maintainer antworten meist innerhalb von 4 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Card-Forge/forge#13128 ·
Maintainer antworten meist innerhalb von 1 Tag
-
client documentation
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 86/100
ClickHouse/clickhouse-java#3469 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
Maintainer antworten meist innerhalb von 1 Tag