Compare commits

..

24 Commits
c8 ... a8

Author SHA1 Message Date
d2bbec30bf Backport upstream patch to fix distro detection
Obtained from: https://github.com/sosreport/sos/pull/3870

(cherry picked from commit 4ac73599d4)
2024-12-13 13:13:51 +09:00
d8ab75a5d3 Sync to current c8 branch 2024-12-13 13:08:04 +09:00
70f761b1a6 Merge branch 'c8' into a8 2024-06-24 14:17:48 +00:00
42eb26ff49 Merge branch 'c8' into a8 2024-05-23 07:49:15 +03:00
624bf068e2 Merge branch 'c8' into a8 2024-04-10 10:47:42 +03:00
d0f598ea3b Merge branch 'c8' into a8 2024-02-08 12:21:00 +03:00
9c3c7dda25 Merge branch 'c8' into a8 2023-11-15 11:19:16 +03:00
d43c16c971 Merge branch 'c8' into a8 2023-09-26 17:36:49 +03:00
eabdullin
7f2373189e Merge branch 'c8' into a8 2023-08-31 10:22:33 +03:00
eabdullin
947d52575e Merge branch 'c8' into a8 2023-07-26 17:07:52 +03:00
392763ef57 Merge branch 'c8' into a8 2023-06-28 15:20:00 +00:00
eabdullin
44709b4e3a Merge branch 'c8' into a8 2023-05-31 18:38:42 +00:00
eabdullin
adb6f494c9 Merge branch 'c8' into a8 2023-04-04 08:52:22 +00:00
eabdullin
89bda742f0 Merge branch 'c8' into a8 2023-03-16 11:25:12 +00:00
796f7c6945 Update almalinux branding patch 2022-11-08 12:28:24 +03:00
bb6420e278 Merge branch 'c8' into a8 2022-11-08 12:27:41 +03:00
eabdullin
565f929b55 Merge branch 'c8' into a8 2022-10-25 09:33:04 +00:00
eabdullin
53bbad578a Merge branch 'c8' into a8 2022-08-03 08:24:46 +00:00
6557c921f1 Fix changelog 2022-05-25 12:16:32 +03:00
eabdullin
9bb48f561c Merge branch 'c8' into a8 2022-05-25 07:44:29 +00:00
eabdullin
9146e99630 Merge branch 'c8' into a8 2022-05-10 11:53:08 +00:00
eabdullin
77f0ec23f4 Merge branch 'c8' into a8 2022-02-01 20:15:19 +00:00
eabdullin
324285f720 AlmaLinux changes 2021-11-17 16:35:46 +03:00
8fdc9d3543 AlmaLinux changes 2021-09-15 11:49:33 +00:00
6 changed files with 63 additions and 100 deletions

4
.gitignore vendored
View File

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

View File

@ -1,2 +1,2 @@
928a58267511054d8173802fca3ee8ca087e1eac SOURCES/sos-4.9.2.tar.gz 26aee6ec0ad73c12a4ad0cf50c02082777d654cc SOURCES/sos-4.8.1.tar.gz
00752b68ec5e1141192a9dab7d44377b8d637bf7 SOURCES/sos-audit-0.3-1.tgz 9d478b9f0085da9178af103078bbf2fd77b0175a SOURCES/sos-audit-0.3.tgz

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

@ -1,41 +0,0 @@
--- a/sos/report/plugins/coredump.py
+++ b/sos/report/plugins/coredump.py
@@ -72,8 +72,8 @@
cdump = line.split()
pid = cdump[4]
exe = cdump[-2]
- if regex := self.get_option("executable"):
- if not re.search(regex, exe, re.I):
+ if self.get_option("executable"):
+ if not re.search(self.get_option("executable"), exe, re.I):
continue
cinfo = self.collect_cmd_output(f"coredumpctl info {pid}")
if cinfo['status'] != 0:
--- a/sos/collector/sosnode.py
+++ b/sos/collector/sosnode.py
@@ -372,7 +372,8 @@
for line in result.splitlines():
if not is_list:
try:
- if ls := line.split():
+ ls = line.split()
+ if ls:
res.append(ls[0])
except Exception as err:
self.log_debug(f"Error parsing sos help: {err}")
--- a/sos/report/plugins/mongodb.py
+++ b/sos/report/plugins/mongodb.py
@@ -87,9 +87,11 @@
)
def setup(self):
- if get_juju_info := self.path_exists('/var/lib/juju/db'):
+ if self.path_exists('/var/lib/juju/db'):
+ get_juju_info = self.path_exists('/var/lib/juju/db')
self.db_folder = "/var/lib/juju/db"
- elif get_juju_info := self.path_exists('/var/snap/juju-db/curent/db'):
+ elif self.path_exists('/var/snap/juju-db/curent/db'):
+ get_juju_info = self.path_exists('/var/snap/juju-db/curent/db')
self.db_folder = "/var/snap/juju-db/current/db"
super().setup()

View File

@ -1,29 +0,0 @@
--- /dev/null 2025-04-03 01:35:45.132999852 +0200
+++ sos-4.9.2/bin/sosreport 2025-04-15 13:54:04.924751581 +0200
@@ -0,0 +1,5 @@
+#!/usr/bin/python3
+msg = ("sosreport binary is deprecated, use 'sos report' instead")
+print(msg)
+
+# vim:ts=4 et sw=4
--- /dev/null 2025-04-03 01:35:45.132999852 +0200
+++ sos-4.9.2/bin/sos-collector 2025-04-15 15:10:17.780281627 +0200
@@ -0,0 +1,5 @@
+#!/usr/bin/python3
+msg = ("sos-collector binary is deprecated, use 'sos collector' instead")
+print(msg)
+
+# vim:ts=4 et sw=4
--- sos-4.9.2/setup.py 2025-04-15 15:17:21.938635468 +0200
+++ sos-4.9.2/setup.py 2025-04-15 15:17:41.328198501 +0200
@@ -34,7 +34,7 @@
maintainer_email='jacob.r.hunsaker@gmail.com',
url='https://github.com/sosreport/sos',
license="GPLv2+",
- scripts=['bin/sos'],
+ scripts=['bin/sos', 'bin/sosreport', 'bin/sos-collector'],
data_files=data_files,
packages=find_packages(include=['sos', 'sos.*'])
)

View File

@ -1,11 +1,11 @@
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%global auditversion 0.3-1 %global auditversion 0.3
Summary: A set of tools to gather troubleshooting information from a system Summary: A set of tools to gather troubleshooting information from a system
Name: sos Name: sos
Version: 4.9.2 Version: 4.8.1
Release: 1%{?dist} Release: 1%{?dist}.alma.1
Group: Applications/System Group: Applications/System
Source0: https://github.com/sosreport/sos/archive/%{version}/sos-%{version}.tar.gz Source0: https://github.com/sosreport/sos/archive/%{version}/sos-%{version}.tar.gz
Source1: sos-audit-%{auditversion}.tgz Source1: sos-audit-%{auditversion}.tgz
@ -22,8 +22,9 @@ Recommends: python3-pexpect
Recommends: python3-pyyaml Recommends: python3-pyyaml
Conflicts: vdsm < 4.40 Conflicts: vdsm < 4.40
Obsoletes: sos-collector Obsoletes: sos-collector
Patch1: sos-python36-walrus-operator.patch
Patch2: sosreport-binary.patch # AlmaLinux patches
Patch1000: sos-patch-upstream-3870.patch
%description %description
Sos is a set of tools that gathers information about system Sos is a set of tools that gathers information about system
@ -34,8 +35,9 @@ support technicians and developers.
%prep %prep
%setup -qn %{name}-%{version} %setup -qn %{name}-%{version}
%setup -T -D -a1 -q %setup -T -D -a1 -q
%patch -P 1 -p1
%patch -P 2 -p1 # AlmaLinux patches
%patch1000 -p1
%build %build
%py3_build %py3_build
@ -59,17 +61,18 @@ mkdir -p %{buildroot}%{_sysconfdir}/sos/{cleaner,presets.d,extras.d,groups.d}
# internationalization is currently broken. Uncomment this line once fixed. # internationalization is currently broken. Uncomment this line once fixed.
# %%files -f %%{name}.lang # %%files -f %%{name}.lang
%files %files
%{_sbindir}/sos
%{_sbindir}/sosreport %{_sbindir}/sosreport
%{_sbindir}/sos
%{_sbindir}/sos-collector %{_sbindir}/sos-collector
%dir /etc/sos/presets.d %dir /etc/sos/presets.d
%dir /etc/sos/extras.d %dir /etc/sos/extras.d
%dir /etc/sos/groups.d %dir /etc/sos/groups.d
/etc/tmpfiles.d/%{name}.conf /etc/tmpfiles.d/%{name}.conf
%{python3_sitelib}/* %{python3_sitelib}/*
%{_mandir}/man1/sosreport.1.gz
%{_mandir}/man1/sos-clean.1.gz %{_mandir}/man1/sos-clean.1.gz
%{_mandir}/man1/sos-upload.1.gz
%{_mandir}/man1/sos-collect.1.gz %{_mandir}/man1/sos-collect.1.gz
%{_mandir}/man1/sos-collector.1.gz
%{_mandir}/man1/sos-help.1.gz %{_mandir}/man1/sos-help.1.gz
%{_mandir}/man1/sos-mask.1.gz %{_mandir}/man1/sos-mask.1.gz
%{_mandir}/man1/sos-report.1.gz %{_mandir}/man1/sos-report.1.gz
@ -82,7 +85,7 @@ mkdir -p %{buildroot}%{_sysconfdir}/sos/{cleaner,presets.d,extras.d,groups.d}
%package audit %package audit
Summary: Audit use of some commands for support purposes Summary: Audit use of some commands for support purposes
License: GPL-2.0-or-later License: GPLv2+
Group: Application/System Group: Application/System
%description audit %description audit
@ -105,24 +108,11 @@ of the system. Currently storage and filesystem commands are audited.
%{_mandir}/man8/sos-audit.sh.8.gz %{_mandir}/man8/sos-audit.sh.8.gz
%ghost /etc/audit/rules.d/40-sos-filesystem.rules %ghost /etc/audit/rules.d/40-sos-filesystem.rules
%ghost /etc/audit/rules.d/40-sos-storage.rules %ghost /etc/audit/rules.d/40-sos-storage.rules
%license LICENSE
%changelog %changelog
* Fri Jul 04 2025 Jan Jansky <jjansky@redhat.com> = 4.9.2-1 * Fri Dec 13 2024 Koichiro Iwao <meta@almalinux.org> - 4.8.1-1.alma.1
- Update to 4.9.2 in RHEL 8 - Backport upstream patch to fix distro detection
Resolves: RHEL-101716 Obtained from: https://github.com/sosreport/sos/pull/3870
* Fri May 30 2025 Jan Jansky <jjansky@redhat.com> = 4.9.1-2
- Update to 4.9.1-2 in RHEL 8
Resolves: RHEL-86645
* Tue Apr 15 2025 Jan Jansky <jjansky@redhat.com> = 4.9.1-1
- Update to 4.9.1 in RHEL 8
Resolves: RHEL-86645
* Tue Jan 07 2025 Jan Jansky <jjansky@redhat.com> = 4.8.2-1
- Update to 4.8.2 in RHEL 8
Resolves: RHEL-72941
* Wed Oct 23 2024 Jan Jansky <jjansky@redhat.com> = 4.8.1-1 * Wed Oct 23 2024 Jan Jansky <jjansky@redhat.com> = 4.8.1-1
- Update to 4.8.1 in RHEL 8 - Update to 4.8.1 in RHEL 8