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

Race condition in reuse lint causes unnecessary failures #1121

Open
CobaltCause opened this issue Dec 24, 2024 · 4 comments
Open

Race condition in reuse lint causes unnecessary failures #1121

CobaltCause opened this issue Dec 24, 2024 · 4 comments

Comments

@CobaltCause
Copy link

reuse lint appears to collect a list of paths to check and then iterate over the collected paths and generate a report for them. If a file is created in time for it to be collected into the list and deleted before its report gets generated, reuse lint fails. I believe the root cause is the exception raised here:

raise OSError(f"{path} is not a file")

I think this situation should not cause reuse lint to fail but rather be handled gracefully by simply ignoring files that no longer exist.

@rettichschnidi
Copy link

Reuse is about ensuring that all files have proper licensing and copyright information. Having files appear/disappear while reuse is running seems to undermine that goal. Personally, I'd really not want reuse to try to be clever in such cases, and I want it to fail.

@CobaltCause
Copy link
Author

CobaltCause commented Dec 24, 2024

Hmm, my use case is that I'd like to run reuse lint in CI for my projects, which also runs a bunch of other things, all of which run concurrently. When I noticed this issue, the specific files I was getting this error with were intermediate files generated by a compiler.

Also, if files are created after reuse lint collects its path list but before it generates reports for them, reuse lint will currently silently ignore them. I'm not sure if that would really be possible to fix.

@rettichschnidi
Copy link

rettichschnidi commented Dec 24, 2024

I'm not sure if that would really be possible to fix.

Run reuse before anything else. There should be no need to do it concurrently, as reuse does not take a long time to finish.

Alternatively - how about list the (I guess) files generated by other parts of the build system into .gitignore?

@CobaltCause
Copy link
Author

Alternatively - how about list the (I guess) files generated by other parts of the build system into .gitignore?

Hmm, but they are...

Ah, I think I see the problem: the particular situation in which this arose for me was testing generated projects from a template, and the generation does not do git init. So, a .gitignore exists, but there is no .git directory. I guess that must be causing reuse to not respect the .gitignore for some reason.

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

No branches or pull requests

2 participants