fsfe / reuse-docs

REUSE recommendations, tutorials, FAQ and specification

Home Page:https://reuse.software

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Snippet documentation seems to contradict example

bernhardreiter opened this issue · comments

The instructions say:

reuse-docs/spec.md

Lines 176 to 177 in 0913b0a

Do note that SPDX snippet tags MUST start with `SPDX-Snippet`, meaning that the
correct copyright notice in a snippet is `SPDX-SnippetCopyrightText`.

but in the example only one of the two tags has the "Snippet":

reuse-docs/spec.md

Lines 182 to 184 in 0913b0a

# SPDX-SnippetBegin
# SPDX-License-Identifier: MIT
# SPDX-SnippetCopyrightText: 2022 Jane Doe <jane@example.com>

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

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:

  • PackageLicenseDeclared
  • PackageLicenseInfoFromFiles
  • PackageLicenseConcluded

File level:

  • LicenseInfoInFile
  • LicenseConcluded

Snippet level:

  • LicenseInfoInSnippet
  • SnippetLicenseConcluded

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.

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