fsfe / reuse-docs

REUSE recommendations, tutorials, FAQ and specification
https://reuse.software
19 stars 20 forks source link

Snippet documentation seems to contradict example #146

Open bernhardreiter opened 3 months ago

bernhardreiter commented 3 months ago

The instructions say:

https://github.com/fsfe/reuse-docs/blob/0913b0a83b36c161966be1c5e70c81bdadfb8a69/spec.md?plain=1#L176-L177

but in the example only one of the two tags has the "Snippet": https://github.com/fsfe/reuse-docs/blob/0913b0a83b36c161966be1c5e70c81bdadfb8a69/spec.md?plain=1#L182-L184

Why doesn't the License-Identifier need a prepended Snippet?

silverhook commented 3 months ago

Good catch, @bernhardreiter (also, great to hear from you, it’s been a while!)

This is to do with SPDX really: https://spdx.github.io/spdx-spec/v2.3/file-tags/#h3-snippet-tags-format https://spdx.github.io/spdx-spec/v2.3/file-tags/#h4-caveats https://spdx.github.io/spdx-spec/v2.3/using-SPDX-short-identifiers-in-source-files/

The problem is that License-Identifier is (older and) specific when it comes to SPDX tags, and therefore not bound to the File. Which also kinda explains why it looks different with the dash instead of CamelCase.

There are other package-, file-, and snippet-level SDPX (2.x) tags:

Package level:

File level:

Snippet level:

But the major difference is that these are intended to be in the SPDX Document, which is typically generated by a tool such as a license scanner or SCA tool that parses information found in the source code; whereas License-Identifier was specifically created to be used in source code, and therefore the tools would translate License-Identifier into the appropriate tag in the SPDX Document.

That said, yes, we probably should clarify within REUSE – just as it already is in SDPX File Tags annex – that License-Identifier is a special case.

mxmehl commented 3 months ago

Good catch, indeed. It's also wrong in the FAQ, we should fix that before 3.2 spec.