From f3bb5e211c697a15a1e6fa4e0cebc8663587523e Mon Sep 17 00:00:00 2001 From: dufuhang Date: Thu, 19 Sep 2024 14:19:26 +0800 Subject: [PATCH] check_positive has some contradictions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 在`check_positive()`函数的raise语句中,错误信息与if条件冲突。 2. 如果`val`的值为 0,它会通过if条件,但会抛出错误信息,提示`[0 has to be >= 0]`。 3. 该PR移除了raise语句中的`=`,因此当`val`为0时,会正确提示`val`的值`[has to be > 0]`。 (cherry picked from commit 66dea7cbb83f724a40d5995a0e5de4ea6566d235) --- ...eck_positive-has-some-contradictions.patch | 25 +++++++++++++++++++ tuned.spec | 6 ++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 bugfix-check_positive-has-some-contradictions.patch diff --git a/bugfix-check_positive-has-some-contradictions.patch b/bugfix-check_positive-has-some-contradictions.patch new file mode 100644 index 0000000..e19ad47 --- /dev/null +++ b/bugfix-check_positive-has-some-contradictions.patch @@ -0,0 +1,25 @@ +From d55d5c280758b6fed2c8c598a380c3c6cdc11b18 Mon Sep 17 00:00:00 2001 +From: dufuhang +Date: Thu, 19 Sep 2024 14:15:53 +0800 +Subject: [PATCH] check_positive has some contradictions + +--- + tuned-adm.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tuned-adm.py b/tuned-adm.py +index fcf19e2..6e5ac85 100755 +--- a/tuned-adm.py ++++ b/tuned-adm.py +@@ -34,7 +34,7 @@ def check_positive(value): + except ValueError: + val = -1 + if val <= 0: +- raise argparse.ArgumentTypeError("%s has to be >= 0" % value) ++ raise argparse.ArgumentTypeError("%s has to be > 0" % value) + return val + + def check_log_level(value): +-- +2.43.0 + diff --git a/tuned.spec b/tuned.spec index 112daab..d92aba6 100644 --- a/tuned.spec +++ b/tuned.spec @@ -1,7 +1,7 @@ Summary: A system tuning service for Linux Name: tuned Version: 2.20.0 -Release: 2 +Release: 3 License: GPLv2+ Source0: https://github.com/redhat-performance/%{name}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz URL: http://www.tuned-project.org/ @@ -36,6 +36,7 @@ Patch2: tuned-2.18.0-sd-load-balance.patch Patch3: change-the-default-percentage-when-dirty-data-starts.patch Patch4: tuned-add-app-sensor-profile.patch Patch5: profiles-drop-sched_-tuning-where-appropriate.patch +Patch6: bugfix-check_positive-has-some-contradictions.patch Provides: tuned-gtk = %{version}-%{release} Provides: tuned-utils = %{version}-%{release} @@ -295,6 +296,9 @@ fi %{_mandir}/man7/tuned-profiles-spectrumscale-ece.7* %changelog +* Thu Sep 19 2024 dufuhang - 2.20.0-3 +- bugfix: check_positive has some contradictions + * Fri Apr 12 2024 liuchao - 2.20.0-2 - profiles: drop sched_ tuning where appropriate -- Gitee