fsfe / reuse-tool

reuse is a tool for compliance with the REUSE recommendations.
https://reuse.software
413 stars 150 forks source link

reuse-tool illegally erases other SPDX file fields such as `SPDX-FileAttributionText` #905

Open Gnuxie opened 9 months ago

Gnuxie commented 9 months ago

When using reuse annotate --license="AFL-3.0 AND Apache-2.0" --merge-copyrights --copyright-style=spdx --copyright="A Test <a.test.example.org>" on a file with a header such as

// Copyright 2022 - 2023 Gnuxie <Gnuxie@protonmail.com>
// Copyright 2019 2022 The Matrix.org Foundation C.I.C.
//
// SPDX-License-Identifier: AFL-3.0 AND Apache-2.0
//
// SPDX-FileAttributionText: <text>
// This modified file incorporates work from mjolnir
// https://github.com/matrix-org/mjolnir
// </text>

The copyright and license fields are correctly preserved but the attribution text is removed

// Copyright 2022 - 2023 Gnuxie <Gnuxie@protonmail.com>
// Copyright 2019 2022 The Matrix.org Foundation C.I.C.
// SPDX-FileCopyrightText: 2024 A Test <a.test.example.org>
//
// SPDX-License-Identifier: AFL-3.0 AND Apache-2.0

This is a rewrite of https://github.com/fsfe/reuse-tool/issues/904 now that more context is understood.

mxmehl commented 9 months ago

It's the default behaviour to replace the header. You can add the following flag for annotate: --no-replace do not replace the first header in the file; just add a new one

Whether this default behaviour is what the majority of the users want is a different question. It makes sense in many cases, it doesn't in some others.

carmenbianca commented 9 months ago

I'm inclined to say that miscellaneous SPDX file fields should be preserved by annotate.

mxmehl commented 9 months ago

I'm inclined to say that miscellaneous SPDX file fields should be preserved by annotate.

I would agree.

However, when implementing this we should check how this would interfere with existing SPDX tags for copyright and licensing, or also contributors (which we also support), and the merge flag. It changed the currently default behaviour, so we should make sure that we don't break workflows.