From 54e2d4bd44a8f8fdc7fb00bbe5140bd60340a5c0 Mon Sep 17 00:00:00 2001 From: "John B. Wyatt IV" Date: Thu, 31 Jul 2025 10:44:14 -0400 Subject: [PATCH] Fix syntax warnings with raw strings Resolves: RHEL-106287 Signed-off-by: John B. Wyatt IV --- ...ing-syntax-warnings-with-raw-strings.patch | 59 +++++++++++++++++++ tuna.spec | 7 ++- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 tuna-Fix-string-syntax-warnings-with-raw-strings.patch diff --git a/tuna-Fix-string-syntax-warnings-with-raw-strings.patch b/tuna-Fix-string-syntax-warnings-with-raw-strings.patch new file mode 100644 index 0000000..28f9118 --- /dev/null +++ b/tuna-Fix-string-syntax-warnings-with-raw-strings.patch @@ -0,0 +1,59 @@ +From aca839256c548b1e4b6b891eb6e3e01d78972062 Mon Sep 17 00:00:00 2001 +From: "John B. Wyatt IV" +Date: Mon, 28 Oct 2024 17:57:15 -0400 +Subject: [PATCH] tuna: Fix string syntax warnings with raw strings + +tuna save allows you to save your kthreads tunables to +a file to be used by rtctl. There were several backslashes that produce +an error that pylint and Python (at least 3.12) gives a SyntaxWarning: +invalid escape sequence + +Switch the strings written to the file with raw strings to resolve the +warning for this section of the code. + +Tested by comparing the diffs of the files. + +Signed-off-by: John B. Wyatt IV +Signed-off-by: John B. Wyatt IV +Signed-off-by: John Kacur +--- + tuna/tuna.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tuna/tuna.py b/tuna/tuna.py +index bd678e2..d4c3e2c 100755 +--- a/tuna/tuna.py ++++ b/tuna/tuna.py +@@ -669,7 +669,7 @@ def generate_rtgroups(filename, kthreads, nr_cpus): + # The regex is matched against process names as printed by "ps -eo cmd". + + ''' % filename) +- f.write("kthreads:*:1:*:\[.*\]$\n\n") ++ f.write(r"kthreads:*:1:*:\[.*\]$" + "\n\n") + + per_cpu_kthreads = [] + names = list(kthreads.keys()) +@@ -688,7 +688,7 @@ def generate_rtgroups(filename, kthreads, nr_cpus): + elif common[:8] == "softirq-": + common = "(sirq|softirq)" + common[7:] + name = "s" + name[4:] +- regex = common + "\/.*" ++ regex = common + r"\/.*" + except: + idx = 0 + regex = name +@@ -701,9 +701,9 @@ def generate_rtgroups(filename, kthreads, nr_cpus): + else: + mask = ",".join([hex(a) for a in \ + procfs.hexbitmask(kt.affinity, nr_cpus)]) +- f.write("%s:%c:%d:%s:\[%s\]$\n" % (name, \ ++ f.write(r"%s:%c:%d:%s:\[%s\]$" % (name, \ + tuna_sched.sched_str(kt.policy)[6].lower(), \ +- kt.rtprio, mask, regex)) ++ kt.rtprio, mask, regex) + "\n") + f.close() + + +-- +2.50.1 + diff --git a/tuna.spec b/tuna.spec index 9c75c85..e64cf2e 100644 --- a/tuna.spec +++ b/tuna.spec @@ -1,6 +1,6 @@ Name: tuna Version: 0.19 -Release: 5%{?dist} +Release: 6%{?dist} License: GPL-2.0-only AND LGPL-2.1-only Summary: Application tuning GUI & command line utility URL: https://git.kernel.org/pub/scm/utils/tuna/tuna.git @@ -20,6 +20,7 @@ Patch04: 0001-tuna-extract-common-cpu-and-nics-determination-code-.patch Patch05: 0002-tuna-Add-idle_state-control-functionality.patch Patch06: 0003-tuna-utils-A-few-tweaks.patch Patch07: tuna-replace-match-with-if-statements-as-a-workaroun.patch +Patch08: tuna-Fix-string-syntax-warnings-with-raw-strings.patch %description Provides interface for changing scheduler and IRQ tunables, at whole CPU and at @@ -73,6 +74,10 @@ done %{_datadir}/polkit-1/actions/org.tuna.policy %changelog +* Thu Jul 31 2025 John B. Wyatt IV - 0.19-6 +- Fix syntax warnings with raw strings +Resolves: RHEL-106287 + * Tue Jul 29 2025 John B. Wyatt IV - 0.19-5 - Add cpu_power command Resolves: RHEL-106293