From e4102fef22a7bd2f1f62ea44a5ecae6378ce57d7b30590aabc31172df2723f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Str=C3=B6der?= Date: Wed, 29 Jan 2020 19:12:32 +0000 Subject: [PATCH] Accepting request 768404 from home:dimstar:Factory Seems to actually work - the cpu_affinity test is failing every now and then, but I see that even on my kernel 5.4 system OBS-URL: https://build.opensuse.org/request/show/768404 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-psutil?expand=0&rev=113 --- pr_1665.patch | 61 +++++++++++++++++++++++++++++++++++++++++++ python-psutil.changes | 6 +++++ python-psutil.spec | 4 ++- 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 pr_1665.patch diff --git a/pr_1665.patch b/pr_1665.patch new file mode 100644 index 0000000..c419b56 --- /dev/null +++ b/pr_1665.patch @@ -0,0 +1,61 @@ +From df417c78f9b91fa19e3dd04645d584f572dac4de Mon Sep 17 00:00:00 2001 +From: Mike Hommey +Date: Fri, 17 Jan 2020 10:27:04 +0900 +Subject: [PATCH 1/2] Future-proof disk_ui_counters on Linux. + +Kernel 5.5 added 2 more fields to /proc/diskstats, requiring another +change after the one for 4.18, which recently added 4 fields. + +At this point in time, the meaning of the existing fields is unlikely to +change, and psutil is not using any of the newer ones. By considering +18 fields and more to have the current layout, psutil will continue to +work as newer kernels add more fields. +--- + psutil/_pslinux.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py +index c681439d4..673475116 100644 +--- a/psutil/_pslinux.py ++++ b/psutil/_pslinux.py +@@ -1066,6 +1066,7 @@ def read_procfs(): + # "3 1 hda1 8 8 8 8" + # 4.18+ has 4 fields added: + # "3 0 hda 8 8 8 8 8 8 8 8 8 8 8 0 0 0 0" ++ # 5.5 has 2 more fields. + # See: + # https://www.kernel.org/doc/Documentation/iostats.txt + # https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats +@@ -1080,7 +1081,7 @@ def read_procfs(): + reads = int(fields[2]) + (reads_merged, rbytes, rtime, writes, writes_merged, + wbytes, wtime, _, busy_time, _) = map(int, fields[4:14]) +- elif flen == 14 or flen == 18: ++ elif flen == 14 or flen >= 18 + # Linux 2.6+, line referring to a disk + name = fields[2] + (reads, reads_merged, rbytes, rtime, writes, writes_merged, + +From ae5532a70b653435adbf8c7e86c3baa0bd3f90dc Mon Sep 17 00:00:00 2001 +From: Giampaolo Rodola +Date: Fri, 17 Jan 2020 12:32:05 +0100 +Subject: [PATCH 2/2] fix typo + +--- + psutil/_pslinux.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py +index 673475116..d8f8ed5c8 100644 +--- a/psutil/_pslinux.py ++++ b/psutil/_pslinux.py +@@ -1081,7 +1081,7 @@ def read_procfs(): + reads = int(fields[2]) + (reads_merged, rbytes, rtime, writes, writes_merged, + wbytes, wtime, _, busy_time, _) = map(int, fields[4:14]) +- elif flen == 14 or flen >= 18 ++ elif flen == 14 or flen >= 18: + # Linux 2.6+, line referring to a disk + name = fields[2] + (reads, reads_merged, rbytes, rtime, writes, writes_merged, + diff --git a/python-psutil.changes b/python-psutil.changes index 339b91d..545a53f 100644 --- a/python-psutil.changes +++ b/python-psutil.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jan 29 16:58:27 UTC 2020 - Dominique Leuenberger + +- Add pr_1665.patch: Future-proof disk_io_counters on Linux. Fixes + tests with Linux 5.5. + ------------------------------------------------------------------- Thu Nov 28 17:10:26 UTC 2019 - Arun Persaud diff --git a/python-psutil.spec b/python-psutil.spec index 66b5f43..48c0d15 100644 --- a/python-psutil.spec +++ b/python-psutil.spec @@ -1,7 +1,7 @@ # # spec file for package python-psutil # -# Copyright (c) 2019 SUSE LLC +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -33,6 +33,7 @@ Patch0: pr_1364.patch Patch1: skip-test-missing-warnings.patch Patch2: skip-flaky-i586.patch Patch3: skip-obs.patch +Patch4: pr_1665.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -59,6 +60,7 @@ A graphical interface that lets you easily analyze and introspect unaltered runn %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 # Remove shebangs sed -i "1s/#!.*//" psutil/{__init__.py,_compat.py,_psbsd.py,_pslinux.py,_psosx.py,_psposix.py,_pssunos.py,_pswindows.py}