Fix TypeError: 'NoneType' object is not callable in magic.close()

Resolves: RHEL-151423
This commit is contained in:
Vincent Mihalkovic 2026-02-23 19:18:14 +01:00
parent af0133c16b
commit d3f8cfbfa5
2 changed files with 28 additions and 1 deletions

20
file-5.47-python.patch Normal file
View File

@ -0,0 +1,20 @@
diff --git a/python/magic.py b/python/magic.py
index a528cbc..eb153b0 100644
--- a/python/magic.py
+++ b/python/magic.py
@@ -111,12 +111,14 @@ _errno.argtypes = [magic_t]
class Magic(object):
def __init__(self, ms):
self._magic_t = ms
+ self._close = _close
def close(self):
"""
Closes the magic database and deallocates any resources used.
"""
- _close(self._magic_t)
+ if self._close:
+ self._close(self._magic_t)
@staticmethod
def __tostr(s):

View File

@ -15,7 +15,7 @@
Summary: Utility for determining file types
Name: file
Version: 5.45
Release: 8%{?dist}
Release: 9%{?dist}
# Main license is BSD-2-Clause-Darwin
# Shipped exceptions:
@ -52,6 +52,9 @@ Patch4: file-5.45-time-t.patch
# upstream: https://github.com/file/file/commit/aa86458e499d6279c2fd18e98425e6ae891d0f33
Patch6: file-5.47-erofs-magic.patch
# Upstream commit 141dde1fe573e6c42800d12affb94c927b44da3e
Patch7: file-5.47-python.patch
URL: https://www.darwinsys.com/file/
Requires: file-libs%{?_isa} = %{version}-%{release}
BuildRequires: zlib-devel
@ -235,6 +238,10 @@ make -C tests check
%endif
%changelog
* Mon Feb 23 2026 Vincent Mihalkovic <vmihalko@redhat.com> - 5.45-9
- Fix TypeError: 'NoneType' object is not callable in magic.close()
Resolves: RHEL-151423
* Wed Mar 26 2025 Vincent Mihalkovic <vmihalko@redhat.com> - 5.45-8
- magic: Use the bcachefs-uuid for erofs
Resolves: RHEL-76142