Reuse addheader tool is being _too_ smart when placing REUSE headers
reuse addheader can mess things up when a copyright statement exists in a file.
You can try it out by running reuse addheader --style python --copyright me --license GPL-2.0-only on the following file https://github.com/fish-shell/fish-shell/blob/a5764663e7b1a2570ea5bc52a0153b329936a090/share/completions/rsync.fish
What happens is that if finds a pre-existing copyright statement in a snippet, and then does two weird things:
- it writes the REUSE headers after the snippet’s copyright statement – which is clearly false, but at least nothing got lost
- it removes parts of the comments around the pre-existing copyright statement – which is a big problem
I suggest we:
- deprecate non-SPDX-tagged copyright statements also in the tool
- not have the tool mess with snippets, unless we introduce full snippet support – and even then the above bug should not be happening
The same issue can be replicated with this file: https://github.com/fish-shell/fish-shell/blob/a5764663e7b1a2570ea5bc52a0153b329936a090/src/fallback.cpp
Here it simply eats up the whole BSD-2-Clause license.
… there are even more examples in the https://github.com/fish-shell/fish-shell/pull/9326 PR message.
Suggested fix seems correct. I have had a bad time with REUSE modifying existing license blocks. Luckily it is easy to revert/unstage using git. This will get reuse-tool to a more predictable behavior. We can always add clever features afterwards.
This PR partially helps with this issue: https://github.com/fsfe/reuse-tool/pull/550
Not entirely, though. I'm especially confused about this:
it removes parts of the comments around the pre-existing copyright statement – which is a big problem
Not sure what's happening there.
I'll hope to have some time to take a good look at this.
I suspect the fact that we allow for any format of a copyright statement, when it finds the word Copyright etc. it assumes that’s part of a REUSE tag and then:
- adds its own copyright statement there; and
- “cleans up” “needless” “extra comment lines” around the copyright statement
Thank you for your time and contributions! Unfortunately, this issue has been inactive for quite a while which means we probably can't manage the time to deal with it. That's why we're marking it as stale. We want to keep things tidy and focus on active discussions, but we’re always happy to revisit if this is still relevant!
If you’d like to keep this open, please add a comment to let us know and remove the label stale. Otherwise, this issue will most likely be automatically closed soon.
This is still an issue. I can replicate this bug still in 5.0.2.
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/621. Any comments subsequent to this comment will not be migrated.