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

Crash handler does not attempt to create directory for crash reports #10041

Open
correctmost opened this issue Oct 23, 2024 · 3 comments
Open
Labels
Needs decision 🔒 Needs a decision before implemention or rejection Proposal 📨
Milestone

Comments

@correctmost
Copy link
Contributor

correctmost commented Oct 23, 2024

Bug description

Pylint attempts to write a crash report to ~/.cache/pylint/ when it encounters a fatal error.

If that directory does not exist (or has been removed), the template will be written to the console instead.

Maybe the crash handler can be enhanced to try to create the directory before writing the report?

Configuration

N/A

Command used

rm -rf ~/.cache/pylint/
# Use https://github.com/pylint-dev/pylint/issues/8746 for the contents of crasher.py
pylint crasher.py

Pylint output

Can't write the issue template for the crash in /home/user/.cache/pylint/pylint-crash-2024-10-23-14-23-08.txt because of: '[Errno 2] No such file or directory: '/home/user/.cache/pylint/pylint-crash-2024-10-23-14-23-08.txt''

Expected behavior

The ~/.cache/pylint/ directory is created and the crash report is written there.

Pylint version

pylint 4.0.0-dev0
astroid 4.0.0-dev0
Python 3.12.7 (main, Oct 1 2024, 11:15:50) [GCC 14.2.1 20240910]

OS / Environment

No response

Additional dependencies

No response

@correctmost correctmost added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Oct 23, 2024
@Pierre-Sassoulas
Copy link
Member

Pierre-Sassoulas commented Oct 23, 2024

Maybe... it's something that was done fast because it was crashing live after a release (crash on crash, not a good look). But at the same time, I thought (think) that it's better to have the crash report displayed in the terminal if we can't write it in the cache dir. Because typically if you don't have write rights to this directory, the probability that you're in a CI job is very high [citation required]. And a file being written correctly in a temporary CI container is very useless as you might not easily be able to reproduce and to see it you'd need to cat it after relaunching the job and changing the CI job (not convenient). Also we need to take into account that pylint could be launched in threads and writing the file from multiple jobs (Refs #5987 #5969 (comment))

@Pierre-Sassoulas Pierre-Sassoulas added Proposal 📨 Needs decision 🔒 Needs a decision before implemention or rejection and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Oct 23, 2024
@correctmost
Copy link
Contributor Author

I encountered this issue while running Pylint in a new VM, so it was a case of a missing directory rather than a permissions error :).

The CI case makes sense. The current behavior seems a bit implicit, but perhaps this ticket can serve as documentation for the future.

I am okay with closing this given the details you added above.

@Pierre-Sassoulas Pierre-Sassoulas added this to the 4.0.0 milestone Oct 24, 2024
@Pierre-Sassoulas
Copy link
Member

The current behavior seems a bit implicit

Yeah. Without certainty because I didn't check when this cache is created, the lack of directory might be an indirect clue that it's a new container that was just fired up (locally or in CI). Not fixing this feels lazy that makes pylint a little unpredictable. At the same time detecting that we're in a CI is hard, and specifying what to do here also take time for something that should not happen (but you're affected a lot by it because of the amazing fuzzing work you do, discovering SO MANY crashes 🚀 ). Let's see what other maintainers think and take a decision before 4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs decision 🔒 Needs a decision before implemention or rejection Proposal 📨
Projects
None yet
Development

No branches or pull requests

2 participants