Backport upstream patch to fix distro detection
Obtained from: https://github.com/sosreport/sos/pull/3870
This commit is contained in:
parent
0f28d881b6
commit
09d5db4b91
48
SOURCES/sos-patch-upstream-3870.patch
Normal file
48
SOURCES/sos-patch-upstream-3870.patch
Normal file
@ -0,0 +1,48 @@
|
||||
From 36fc21545f8bbedca2a498682ceb953979fa7da7 Mon Sep 17 00:00:00 2001
|
||||
From: Koichiro Iwao <meta@almalinux.org>
|
||||
Date: Wed, 11 Dec 2024 14:59:00 +0900
|
||||
Subject: [PATCH] [policies] Fix bug in distro identification
|
||||
|
||||
Fixes a bug in #3764.
|
||||
|
||||
A bug in the distro-identifying logic caused incorrect identification
|
||||
of the distro as CentOS, Fedora, or RHEL under the following conditions:
|
||||
|
||||
1. Distro inherits RedHatPolicy
|
||||
2. Distro has either of /etc/{centos,fedora,redhat}-release
|
||||
3. Policy file appears earlier than redhat.py in dictionary order
|
||||
|
||||
The issue occurs because the distro-identifying logic relies on the
|
||||
existence of the above os_release_file without examining its contents,
|
||||
more than checking NAME or ID in the /etc/os-release file. As a result,
|
||||
once /etc/{centos,fedora,redhat}-release is found, the contents of
|
||||
/etc/os-release are never checked, leading to distro misidentification.
|
||||
|
||||
At least AlmaLinux is affected by this bug.
|
||||
|
||||
Signed-off-by: Koichiro Iwao <meta@almalinux.org>
|
||||
---
|
||||
sos/policies/distros/__init__.py | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/sos/policies/distros/__init__.py b/sos/policies/distros/__init__.py
|
||||
index 66970c72d..989f02067 100644
|
||||
--- a/sos/policies/distros/__init__.py
|
||||
+++ b/sos/policies/distros/__init__.py
|
||||
@@ -163,12 +163,12 @@ def _check_release(content):
|
||||
|
||||
if remote:
|
||||
return _check_release(remote)
|
||||
- # use the os-specific file primarily
|
||||
- if os.path.isfile(cls.os_release_file):
|
||||
- return True
|
||||
- # next check os-release for a NAME or ID value we expect
|
||||
+ # check os-release for a NAME or ID value we expect
|
||||
with open(OS_RELEASE, "r", encoding='utf-8') as f:
|
||||
return _check_release(f.read())
|
||||
+ # next use the os-specific file
|
||||
+ if os.path.isfile(cls.os_release_file):
|
||||
+ return True
|
||||
|
||||
def kernel_version(self):
|
||||
return self.release
|
@ -5,7 +5,7 @@
|
||||
Summary: A set of tools to gather troubleshooting information from a system
|
||||
Name: sos
|
||||
Version: 4.8.1
|
||||
Release: 1%{?dist}
|
||||
Release: 1%{?dist}.alma.1
|
||||
Group: Applications/System
|
||||
Source0: https://github.com/sosreport/sos/archive/%{version}/sos-%{version}.tar.gz
|
||||
Source1: sos-audit-%{auditversion}.tgz
|
||||
@ -23,6 +23,9 @@ Recommends: python3-pyyaml
|
||||
Conflicts: vdsm < 4.40
|
||||
Obsoletes: sos-collector <= 1.9
|
||||
|
||||
# AlmaLinux patches
|
||||
Patch1000: sos-patch-upstream-3870.patch
|
||||
|
||||
%description
|
||||
Sos is a set of tools that gathers information about system
|
||||
hardware and configuration. The information can then be used for
|
||||
@ -33,6 +36,9 @@ support technicians and developers.
|
||||
%setup -qn %{name}-%{version}
|
||||
%setup -T -D -a1 -q
|
||||
|
||||
# AlmaLinux patches
|
||||
%patch1000 -p1
|
||||
|
||||
%build
|
||||
%py3_build
|
||||
|
||||
@ -104,6 +110,10 @@ of the system. Currently storage and filesystem commands are audited.
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Dec 11 2024 Koichiro Iwao <meta@almalinux.org> - 4.8.1-1.alma.1
|
||||
- Backport upstream patch to fix distro detection
|
||||
Obtained from: https://github.com/sosreport/sos/pull/3870
|
||||
|
||||
* Wed Oct 23 2024 Jan Jansky <jjansky@redhat.com> = 4.8.1-1
|
||||
- Update to 4.8.1 in RHEL 9
|
||||
Resolves: RHEL-64159
|
||||
|
Loading…
Reference in New Issue
Block a user