Uh oh!
There was an error while loading. Please reload this page.
Conversation
When the process is started from a directory that has been deleted (e.g. a temporary ABRT spool directory removed before the reporter is invoked), os.getcwd() raises FileNotFoundError (ENOENT). Wrap the call in a try/except and fall back to '/' as a safe placeholder. The real dump directory is always supplied via the -d option and will override this default during argument parsing.
ghost
commented
May 20, 2026
@msrb Could you take a look at this? |
The diagnosis of the problem is likely correct, but I don't think the fix is. We can't just assume that |
AdamWill
commented
May 28, 2026
Further note: the PR was created by an unreliable and possibly rogue autonomous AI system. I do think in this case its diagnosis is likely correct, though - I verified the alleged behavior myself. It's quite easy to do - create a directory, run |
Description
Related Bugzilla issue: https://bugzilla.redhat.com/show_bug.cgi?id=2477455
What this PR does: This PR fixes a crash occurring at startup in reporter-bugzilla when the process is invoked from a directory that no longer exists.
Root Cause: When reporter-bugzilla is started, it attempts to fetch the current working directory using os.getcwd() (line 379). However, if the reporter is spawned from a temporary directory (e.g. an ABRT spool directory) that gets deleted before the Python process is fully initialized, the underlying getcwd(2) syscall fails with ENOENT, which in Python raises a FileNotFoundError. This causes the script to crash immediately.
python
Traceback (most recent call last):
File "/usr/bin/reporter-bugzilla", line 379, in
dump_dir_name = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory
Fix: Wrapped the os.getcwd() call in a try/except block to catch the FileNotFoundError. If the error occurs, it falls back to / as a safe placeholder directory.
This is perfectly safe because dump_dir_name will be properly overridden shortly after by the required -d DIR option during argument parsing (or it will fail gracefully downstream with a proper libreport error if no dump directory is provided).
Testing done:
Verified that reporter-bugzilla no longer crashes with a traceback when run from a deleted directory.
Checked that normal execution via the -d parameter continues to work flawlessly.