Merge pull request '[a9] Sync to c9 and backport upstream patch to fix distro detection' (#1) from metalefty/sos:a9 into a9

Reviewed-on: #1
This commit is contained in:
eabdullin 2024-12-17 09:14:32 +00:00
commit 2c57e95250
6 changed files with 83 additions and 58 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
SOURCES/sos-4.7.1.tar.gz
SOURCES/sos-4.8.1.tar.gz
SOURCES/sos-audit-0.3.tgz

View File

@ -1,2 +1,2 @@
9ced981872d308e13c5dc47fee21071592ceefc2 SOURCES/sos-4.7.1.tar.gz
26aee6ec0ad73c12a4ad0cf50c02082777d654cc SOURCES/sos-4.8.1.tar.gz
9d478b9f0085da9178af103078bbf2fd77b0175a SOURCES/sos-audit-0.3.tgz

View File

@ -1,30 +0,0 @@
From a0c2586e230c9600d3d3f70ab89c9f6eb52ed3ed Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Tue, 23 Apr 2024 11:00:11 +0200
Subject: [PATCH] [archive] Fix get_archive_root after files reordering
Commit d5d8c21 reordered files in the archive, such that the first
member is not the archive root directory further more. Let change the
get_archive_root method accordingly to prevent self.archive_root being
empty.
Resolves: #3616
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
---
sos/cleaner/archives/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sos/cleaner/archives/__init__.py b/sos/cleaner/archives/__init__.py
index f7c5eb587..0fa1ef43f 100644
--- a/sos/cleaner/archives/__init__.py
+++ b/sos/cleaner/archives/__init__.py
@@ -104,7 +104,7 @@ def get_archive_root(self):
if toplevel.isdir():
return toplevel.name
else:
- return os.sep
+ return os.path.dirname(toplevel.name) or os.sep
return os.path.abspath(self.archive_path)
def report_msg(self, msg):

View File

@ -1,19 +0,0 @@
diff -aruN sos-4.7.0/sos/policies/distros/redhat.py sos-4.7.0.alma/sos/policies/distros/redhat.py
--- sos-4.7.0/sos/policies/distros/redhat.py 2024-02-20 03:39:46
+++ sos-4.7.0.alma/sos/policies/distros/redhat.py 2024-04-10 08:58:53
@@ -495,6 +495,15 @@
vendor_urls = [('Community Website', 'https://www.centos.org/')]
+class AlmaLinuxPolicy(RHELPolicy):
+ distro = "AlmaLinux"
+ vendor = "AlmaLinux OS Foundation"
+ vendor_urls = [
+ ('Distribution Website', 'https://www.almalinux.org/'),
+ ('Commercial Support', 'https://tuxcare.com/linux-support-services/')
+ ]
+
+
class RedHatCoreOSPolicy(RHELPolicy):
"""
Red Hat CoreOS is a containerized host built upon Red Hat Enterprise Linux

View File

@ -0,0 +1,43 @@
From e2bd0d93a73c3613dd6eb758437fd54f72e83433 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 | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sos/policies/distros/__init__.py b/sos/policies/distros/__init__.py
index 66970c72d..a2a07a91f 100644
--- a/sos/policies/distros/__init__.py
+++ b/sos/policies/distros/__init__.py
@@ -164,7 +164,10 @@ def _check_release(content):
if remote:
return _check_release(remote)
# use the os-specific file primarily
- if os.path.isfile(cls.os_release_file):
+ # also check the symlink destination
+ if (os.path.isfile(cls.os_release_file) and
+ os.path.basename(cls.os_release_file)
+ == os.path.basename(os.path.realpath(cls.os_release_file))):
return True
# next check os-release for a NAME or ID value we expect
with open(OS_RELEASE, "r", encoding='utf-8') as f:

View File

@ -4,8 +4,8 @@
Summary: A set of tools to gather troubleshooting information from a system
Name: sos
Version: 4.7.1
Release: 3%{?dist}.alma.1
Version: 4.8.1
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
@ -22,10 +22,9 @@ Recommends: python3-pexpect
Recommends: python3-pyyaml
Conflicts: vdsm < 4.40
Obsoletes: sos-collector <= 1.9
Patch1: sos-RHEL-35945-sos-clean-on-archive.patch
# AlmaLinux patches
Patch1000: sos-almalinux-branding.patch
Patch1000: sos-patch-upstream-3870.patch
%description
Sos is a set of tools that gathers information about system
@ -36,7 +35,6 @@ support technicians and developers.
%prep
%setup -qn %{name}-%{version}
%setup -T -D -a1 -q
%patch1 -p1
# AlmaLinux patches
%patch1000 -p1
@ -112,8 +110,41 @@ of the system. Currently storage and filesystem commands are audited.
%changelog
* Mon Jun 24 2024 Andrew Lukoshko <alukoshko@almalinux.org> - 4.7.1-3.alma.1
- Debrand for AlmaLinux
* Fri Dec 13 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
* Tue Oct 15 2024 Jan Jansky <jjansky@redhat.com> = 4.8.0-5
- Rebase to 4.8.0 and adding credential obfuscation
Resolves: RHEL-58096
* Fri Sep 27 2024 Jan Jansky <jjansky@redhat.com> = 4.8.0-4
- Added credentials obfuscation from multiple files
Resolves: RHEL-58096
* Wed Sep 25 2024 Jan Jansky <jjansky@redhat.com> = 4.8.0-3
- Update 4.8.0
Resolves: RHEL-58096
* Thu Sep 19 2024 Jan Jansky <jjansky@redhat.com> = 4.8.0-2
- Update to 4.8.0
Resolves: RHEL-58096
* Mon Sep 09 2024 Pierguido Lambri <plambri@redhat.com> = 4.8.0-1
- New upstream release
Resolves: RHEL-58096
* Wed Aug 21 2024 Pavel Moravec <pmoravec@redhat.com> = 4.7.2-3
- reverting RHEL-22732 patch due to regressions
Resolves: RHEL-49781
* Fri Jun 21 2024 Pierguido Lambri <plambri@redhat.com> = 4.7.2-1
- New upstream release
Resolves: RHEL-49781
* Thu May 09 2024 Pavel Moravec <pmoravec@redhat.com> = 4.7.1-3
- [archive] Fix get_archive_root after files reordering