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

util: fix parsing of copyrights without year #861

Conversation

anthony-loiseau-act
Copy link
Contributor

@anthony-loiseau-act anthony-loiseau-act commented Nov 17, 2023

Fixes a crash when reuse tries to parse an older Copyright line which has no year token. This resulted in a None dereference when a string was expected.

Closes #866

Fixes a crash when reuse tries to parse an older Copyright line
which has no year token. This resulted in a None dereference
when a string was expected.

Signed-off-by: Anthony Loiseau <[email protected]>
Signed-off-by: Anthony Loiseau <[email protected]>
@carmenbianca
Copy link
Member

I think I can see what this PR fixes. Do you have an example for how to trigger the bug, though?

Thanks for the patch @anthony-loiseau-act

@anthony-loiseau-act
Copy link
Contributor Author

Sure. I created an issue ticket to properly sort the root issue I reached and fixed by this proposal. This is #866.

TLDR: Attempting to add a n SPDX with reuse annotate --merge-copyrights --license "BSD-3-Clause" --copyright "Foo Bar <[email protected]>" --year 2023 foo.c onto a file containing // Copyright Mr foo line crashes when parsing year of detected copyright.

@carmenbianca
Copy link
Member

Thanks a heap @anthony-loiseau-act ! Added a test in #873 and merged the PR. Excellent eyes spotting and fixing this bug.

@anthony-loiseau-act anthony-loiseau-act deleted the tmp/16689-fix-reuse-crash-year-parsing branch November 28, 2023 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reuse annotate crashes when parsing legacy copyright lines without year
2 participants