Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The tool currently very poorly deals with erroneous SPDX expressions #4

Open
carmenbianca opened this issue Apr 18, 2019 · 7 comments
Labels
documentation Missing or wrong documentation enhancement New feature or request
Milestone

Comments

@carmenbianca
Copy link
Member

Given a file erroneous-spdx.txt:

SPDX-Copyright: Carmen

SPDX-License-Identifier: MIT OR BSD AND

The output of reuse lint is:

reuse._util - ERROR - Could not parse 'MIT OR BSD AND'
reuse.project - ERROR - erroneous-spdx.txt holds an SPDX expression that cannot be parsed, skipping the file
NO LICENSE

The following files have no license(s):
  erroneous-spdx.txt

NO COPYRIGHT

The following files have no copyright:
  erroneous-spdx.txt

SUMMARY

Bad licenses: 0
Missing licenses: 0
Unused licenses: 0
Used licenses: Apache-2.0, CC-BY-SA-4.0, CC0-1.0, GPL-3.0-or-later
Read errors: 0
Files with copyright information: 47 / 48
Files with license information: 47 / 48

The ERROR statements are just logger output from within the program. The file is then completely skipped over, and its (completely valid) SPDX-Copyright tag is ignored.

Is this sufficient, or should the plumbing somehow change to account for this edge case?

@mxmehl
Copy link
Member

mxmehl commented May 21, 2019

I think it's OK to let this be an error. We should strongly discourage erroneous SPDX expressions to make reuse of software not a guesswork but easy and unambiguous.

See the stupid edge cases Thomas is dealing with in Linux for an example how things can explode to a massive rework even with minor errors ;)

@carmenbianca
Copy link
Member Author

Can you give me more info on what Thomas is currently dealing with? Maybe an article or e-mail I can read.

@mxmehl
Copy link
Member

mxmehl commented May 24, 2019

Sure. It's being discussed on the linux-spdx@vger.kernel.org mailing list. First post

@carmenbianca
Copy link
Member Author

This bug is referred to by the documentation in #80. When this bug is fixed, the documentation should reflect that.

@bittner
Copy link

bittner commented Dec 20, 2020

Somewhat related: reuse addheader allows to add any string you want as a license, e.g.

reuse addheader foobar/__init__.py --license GPLv33

Shouldn't the tool report this as an invalid license identifier and abort the operation, similar to how reuse init behaves?

@nicorikken
Copy link
Member

As I felt the issue raised by @bittner is quite specific, I forked it off into a separate issue.

@mxmehl
Copy link
Member

mxmehl commented Jan 24, 2022

In the example in #463, people will see the following error, even if the block ignore is implemented:

reuse._util - ERROR - Could not parse 'MIT" > file.txt'
reuse.project - ERROR - 'foobar.sh' holds an SPDX expression that cannot be parsed, skipping the file

The suggestion is to make this error more understandable and solvable for users:

  1. Collect these errors, and only display them near the summary block
  2. Combine and explain these errors in a better fashion, e.g. "The files contain text strings that confuse the REUSE tool. It cannot reliably understand what's the actual license and/or copyright. Please see $URL for an explanation and solution."
  3. Create the FAQ item ($URL) that explains the source of problem, and that people shall wrap the problematic lines in the block ignores (Introduce marking a block that lint ignores #463).

@mxmehl mxmehl added documentation Missing or wrong documentation enhancement New feature or request labels Jan 24, 2022
@mxmehl mxmehl added this to the v0.15 milestone Jan 24, 2022
@mxmehl mxmehl modified the milestones: Backlog, v1.1.0 Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Missing or wrong documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants