From 4383a9dbc93764eee4180bc87de17129ea7ed40e Mon Sep 17 00:00:00 2001 From: dirkhub <71777632+dirkhub@users.noreply.github.com> Date: Fri, 28 Aug 2026 09:19:47 +0200 Subject: [PATCH] fix handling when tarinfo is None For unsupported file types like Unix sockets and possibly other types, TarFile.getattrinfo() can return None. This commit reverts the changes from 77898dc7768fa8f5d696aecd031b6cfb022dd7fe to handle avoid crashes. --- omd/packages/omd/omdlib/backup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/omd/packages/omd/omdlib/backup.py b/omd/packages/omd/omdlib/backup.py index 56deb91bbfc..725279f9595 100644 --- a/omd/packages/omd/omdlib/backup.py +++ b/omd/packages/omd/omdlib/backup.py @@ -5,6 +5,9 @@ """Cares about backing up the files of a site""" +# mypy: disable-error-code="comparison-overlap" +# mypy: disable-error-code="redundant-expr" + import contextlib import errno import fnmatch @@ -384,7 +387,7 @@ def _tar_add( # Create a TarInfo object from the file. tarinfo = _get_tar_info_or_raise(tar, name, arcname) # Exclude files. - if not predicate(tarinfo): + if tarinfo is None or not predicate(tarinfo): return # Create a backup of history file and add it to the archive as history.sqlite.