python-linux-procfs: - Fix traceback with non-utf8 chars
Fix traceback with non-utf8 chars Resolves: rhbz#2022530 Signed-off-by: John Kacur <jkacur@redhat.com>
This commit is contained in:
parent
e6dac818f5
commit
0ebf821b7e
33
python-linux-procfs-Fix-traceback-with-non-utf8-char.patch
Normal file
33
python-linux-procfs-Fix-traceback-with-non-utf8-char.patch
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
From 7570fc0d6082cb476c32233c2904214dd57737a8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: John Kacur <jkacur@redhat.com>
|
||||||
|
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 <jkacur@redhat.com>
|
||||||
|
---
|
||||||
|
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
|
||||||
|
|
@ -1,11 +1,6 @@
|
|||||||
%if 0%{?fedora}
|
|
||||||
%else
|
|
||||||
%global without_python3 1
|
|
||||||
%endif
|
|
||||||
|
|
||||||
Name: python-linux-procfs
|
Name: python-linux-procfs
|
||||||
Version: 0.6.3
|
Version: 0.6.3
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Summary: Linux /proc abstraction classes
|
Summary: Linux /proc abstraction classes
|
||||||
URL: https://git.kernel.org/pub/scm/libs/python/%{name}/%{name}.git
|
URL: https://git.kernel.org/pub/scm/libs/python/%{name}/%{name}.git
|
||||||
@ -17,6 +12,9 @@ BuildRequires: python3-setuptools
|
|||||||
%global _description\
|
%global _description\
|
||||||
Abstractions to extract information from the Linux kernel /proc files.
|
Abstractions to extract information from the Linux kernel /proc files.
|
||||||
|
|
||||||
|
# PATCHES
|
||||||
|
Patch1: python-linux-procfs-Fix-traceback-with-non-utf8-char.patch
|
||||||
|
|
||||||
%description %_description
|
%description %_description
|
||||||
|
|
||||||
%package -n python3-linux-procfs
|
%package -n python3-linux-procfs
|
||||||
@ -46,6 +44,10 @@ rm -rf %{buildroot}
|
|||||||
%license COPYING
|
%license COPYING
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Nov 22 2021 John Kacur <jkacur@redhat.com> - 0.6.3-3
|
||||||
|
- Fix traceback with non-utf8 chars
|
||||||
|
Resolves: rhbz#2022530
|
||||||
|
|
||||||
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 0.6.3-2
|
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 0.6.3-2
|
||||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||||
Related: rhbz#1991688
|
Related: rhbz#1991688
|
||||||
|
Loading…
Reference in New Issue
Block a user