reuse-tool icon indicating copy to clipboard operation
reuse-tool copied to clipboard

Output format of "spdx" command / Field name contained in field value

Open buhtz opened this issue 8 months ago • 1 comments

Hello, I would like to discuss an issue, where I am not sure if it is a bug or by intention.

As an example, please allow me to show you a Python file header.

# SPDX-FileCopyrightText: © 2008-2022 Oprea Dan
# SPDX-FileCopyrightText: © 2008-2022 Bart de Koning
# SPDX-FileCopyrightText: © 2008-2022 Richard Bailey
# SPDX-FileCopyrightText: © 2008-2022 Germar Reitze
# SPDX-FileCopyrightText: © 2024 Christian Buhtz <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# This file is part of the program "Back In Time" which is released under GNU
# General Public License v2 (GPLv2). See LICENSES directory or go to
# <https://spdx.org/licenses/GPL-2.0-or-later.html>.
#
# File was splitted from "qt/qttools.py".

Running reuse spdx on the repo gives me this output:

FileName: ./qt/timeline.py
SPDXID: SPDXRef-02090efb1ff77bb065d312c4b7055679
FileChecksum: SHA1: 1a1f748bb5bf08780f5013fd905074c1eade4c3c
LicenseConcluded: NOASSERTION
LicenseInfoInFile: GPL-2.0-or-later
FileCopyrightText: <text>SPDX-FileCopyrightText: © 2008-2022 Bart de Koning
SPDX-FileCopyrightText: © 2008-2022 Germar Reitze
SPDX-FileCopyrightText: © 2008-2022 Oprea Dan
SPDX-FileCopyrightText: © 2008-2022 Richard Bailey
SPDX-FileCopyrightText: © 2024 Christian Buhtz <[email protected]></text>

My problem here is that the string SPDX-FileCopyrightText: is contained in the value of FileCopyrightText.

The output I expect would be:

FileName: ./qt/timeline.py
SPDXID: SPDXRef-02090efb1ff77bb065d312c4b7055679
FileChecksum: SHA1: 1a1f748bb5bf08780f5013fd905074c1eade4c3c
LicenseConcluded: NOASSERTION
LicenseInfoInFile: GPL-2.0-or-later
FileCopyrightText: <text>© 2008-2022 Bart de Koning
© 2008-2022 Germar Reitze
© 2008-2022 Oprea Dan
© 2008-2022 Richard Bailey
© 2024 Christian Buhtz <[email protected]></text>

I am not sure why the <text> tag is in there.

Beside of this I would also prefer to convert that output into a machine readable format. Would be nice if reuse would offer a --json switch, too.

buhtz avatar Apr 04 '25 15:04 buhtz

Hello, I have the same issue, and for me it's a bug since when the copyright comes from file REUSE.toml, there is no such tag in output of reuse spdx.

Example of REUSE.toml:

version = 1

[[annotations]]
path = "test.py"
SPDX-FileCopyrightText = "2025 Dummy Name <[email protected]>"
SPDX-License-Identifier = "GPL-3.0-or-later"

Output of reuse spdx:

FileName: ./test.py
SPDXID: SPDXRef-f11a5687ab9e2d41383adcc42d971ba9
FileChecksum: SHA1: 4541eb18d7055c843e3bea3984b4ad34d3ee4ffc
LicenseConcluded: NOASSERTION
LicenseInfoInFile: GPL-3.0-or-later
FileCopyrightText: <text>2025 Dummy Name <[email protected]></text>

Either the tag should not be there at all (I think this is the best solution as it's useless), or always there, for the sake of consistency.

flashcode avatar Apr 22 '25 11:04 flashcode

I think it's not intentional, seems to appear on every "custom" string, so not only FileCopyrightText but also ExtractedText for custom licenses:

LicenseID: LicenseRef-Unsplash
LicenseName: NOASSERTION
ExtractedText: <text>Unsplash grants you an irrevocable, nonexclusive, worldwide copyright license to download, copy, modify, distribute, perform, and use images from Unsplash for free, including for commercial purposes, without permission from or attributing the photographer or Unsplash. This license does not include the right to compile images from Unsplash to replicate a similar or competing service.</text>

fajfer avatar Nov 08 '25 22:11 fajfer

Ah, I can fix this now that #947 is fixed. Will have a look at it later.

carmenbianca avatar Nov 09 '25 11:11 carmenbianca

Hi! This repository is being migrated away from GitHub towards Codeberg. More context can be found in #865. This issue can henceforth be found at https://codeberg.org/fsfe/reuse-tool/issues/1160. Any comments subsequent to this comment will not be migrated.

carmenbianca avatar Nov 24 '25 14:11 carmenbianca