Backport PR #4690 to avoid failing on empty files when reporting bugs

This commit is contained in:
Adam Williamson 2023-04-11 10:45:35 -07:00
parent 5032e468a5
commit e209729554
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 61155974a597e49bbc2b33ba2dc1e3b70162d99e Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Tue, 11 Apr 2023 10:15:16 -0700
Subject: [PATCH] exception: only attach existent and non-empty files
(#2185827)
libreport barfs (in a non-fatal but scary way) if a file we try
to attach does not exist or is empty. Let's make sure all the
files exist and aren't empty before we try to attach them. In a
current F38+ live install, for instance, both packaging.log and
dnf.librepo.log are usually empty.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
pyanaconda/exception.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
index d507cafcc2..3c39dff0f2 100644
--- a/pyanaconda/exception.py
+++ b/pyanaconda/exception.py
@@ -138,6 +138,10 @@ class AnacondaExceptionHandler(ExceptionHandler):
"""
log.debug("running handleException")
+ # don't try and attach empty or non-existent files (#2185827)
+ self.conf.fileList = [
+ fn for fn in self.conf.fileList if os.path.exists(fn) and os.path.getsize(fn) > 0
+ ]
exception_lines = traceback.format_exception(*dump_info.exc_info)
log.critical("\n".join(exception_lines))
--
2.40.0

View File

@ -1,7 +1,7 @@
Summary: Graphical system installer
Name: anaconda
Version: 38.23.4
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+ and MIT
URL: http://fedoraproject.org/wiki/Anaconda
@ -11,6 +11,10 @@ URL: http://fedoraproject.org/wiki/Anaconda
# ./autogen.sh
# make dist
Source0: https://github.com/rhinstaller/%{name}/releases/download/%{name}-%{version}-1/%{name}-%{version}.tar.bz2
# https://github.com/rhinstaller/anaconda/pull/4690
# https://bugzilla.redhat.com/show_bug.cgi?id=2185827
# Don't try and attach non-existent or empty files to bug reports
Patch0: 0001-exception-only-attach-existent-and-non-empty-files-2.patch
# Versions of required components (done so we make sure the buildrequires
# match the requires versions of things).
@ -469,6 +473,9 @@ rm -rf \
%{_prefix}/libexec/anaconda/dd_*
%changelog
* Tue Apr 11 2023 Adam Williamson <awilliam@redhat.com> - 38.23.4-2
- Backport PR #4690 to avoid failing on empty files when reporting bugs
* Tue Mar 28 2023 Packit <hello@packit.dev> - 38.23.4-1
- Add 'vga' to the list of preserved kernel arguments (#2176782) (awilliam)
- Move ostreecontainer deps to install-img-deps (jkonecny)