From 35b9011eb1c7e5ee06f72c2c8ac166428a6c54ea Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Dec 07 2021 19:21:47 +0000 Subject: import python-linux-procfs-0.6.3-3.el9 --- diff --git a/SOURCES/python-linux-procfs-Fix-traceback-with-non-utf8-char.patch b/SOURCES/python-linux-procfs-Fix-traceback-with-non-utf8-char.patch new file mode 100644 index 0000000..ec5399e --- /dev/null +++ b/SOURCES/python-linux-procfs-Fix-traceback-with-non-utf8-char.patch @@ -0,0 +1,33 @@ +From 7570fc0d6082cb476c32233c2904214dd57737a8 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Fri, 19 Nov 2021 16:03:22 -0500 +Subject: [PATCH] python-linux-procfs: Fix traceback with non-utf8 chars in the + /proc/PID/cmdline + +Fix traceback if there are non-utf8 characters in the /proc/PID/cmdline + +Signed-off-by: John Kacur +--- + procfs/procfs.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/procfs/procfs.py b/procfs/procfs.py +index 3b7474cccb01..408b2bcd0a31 100755 +--- a/procfs/procfs.py ++++ b/procfs/procfs.py +@@ -357,9 +357,9 @@ class process: + return hasattr(self, attr) + + def load_cmdline(self): +- f = open("/proc/%d/cmdline" % self.pid) +- self.cmdline = f.readline().strip().split('\0')[:-1] +- f.close() ++ with open("/proc/%d/cmdline" % self.pid, mode='rb') as f: ++ cmdline = f.readline().decode(encoding='unicode_escape') ++ self.cmdline = cmdline.strip().split('\0')[:-1] + + def load_threads(self): + self.threads = pidstats("/proc/%d/task/" % self.pid) +-- +2.31.1 + diff --git a/SPECS/python-linux-procfs.spec b/SPECS/python-linux-procfs.spec index ae29e18..91ac17b 100644 --- a/SPECS/python-linux-procfs.spec +++ b/SPECS/python-linux-procfs.spec @@ -1,11 +1,6 @@ -%if 0%{?fedora} -%else -%global without_python3 1 -%endif - Name: python-linux-procfs Version: 0.6.3 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2 Summary: Linux /proc abstraction classes URL: https://git.kernel.org/pub/scm/libs/python/%{name}/%{name}.git @@ -17,6 +12,9 @@ BuildRequires: python3-setuptools %global _description\ Abstractions to extract information from the Linux kernel /proc files. +# PATCHES +Patch1: python-linux-procfs-Fix-traceback-with-non-utf8-char.patch + %description %_description %package -n python3-linux-procfs @@ -46,6 +44,10 @@ rm -rf %{buildroot} %license COPYING %changelog +* Mon Nov 22 2021 John Kacur - 0.6.3-3 +- Fix traceback with non-utf8 chars +Resolves: rhbz#2022530 + * Tue Aug 10 2021 Mohan Boddu - 0.6.3-2 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688