From 546b68385dbf8e8c286b4f1bf1fe5421ca3a1a9d Mon Sep 17 00:00:00 2001 From: nathan9513-aps Date: Fri, 15 May 2026 16:23:20 +0200 Subject: [PATCH] reporter-bugzilla: handle FileNotFoundError from os.getcwd() 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. --- src/plugins/python/reporter_bugzilla.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/python/reporter_bugzilla.py b/src/plugins/python/reporter_bugzilla.py index e6db3bf1..ee5b01ec 100755 --- a/src/plugins/python/reporter_bugzilla.py +++ b/src/plugins/python/reporter_bugzilla.py @@ -376,7 +376,14 @@ def log_out(bug_info, rhbz, dump_dir_name): "\n -D, --debug[STR] Debug\n" ) - dump_dir_name = os.getcwd() + try: + dump_dir_name = os.getcwd() + except FileNotFoundError: + # The process was started from a directory that no longer exists + # (e.g. a temporary directory deleted before reporter was invoked). + # Fall back to '/' as a safe placeholder; the real dump directory + # will be supplied via the -d option. + dump_dir_name = '/' conf_files = [] fmt_file = os.path.join(const.CONF_DIR, 'plugins/bugzilla_format.conf') fmt_file2 = fmt_file