From 01a6c98ec5e132053b7e5dde76e839130acf3965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Mon, 26 May 2014 15:27:48 +0200 Subject: [PATCH] New version Resolves: rhbz#1100724 - Dropped ondemand-check patch (upstream dropped the functionality) --- powertop-2.3-ondemand-check.patch | 42 ----------------- ...-fix.patch => powertop-2.6.1-man-fix.patch | 2 +- ... powertop-2.6.1-tunable-overflow-fix.patch | 47 +------------------ powertop.spec | 16 ++++--- sources | 2 +- 5 files changed, 12 insertions(+), 97 deletions(-) delete mode 100644 powertop-2.3-ondemand-check.patch rename powertop-2.3-man-fix.patch => powertop-2.6.1-man-fix.patch (94%) rename powertop-2.5-tunable-overflow-fix.patch => powertop-2.6.1-tunable-overflow-fix.patch (80%) diff --git a/powertop-2.3-ondemand-check.patch b/powertop-2.3-ondemand-check.patch deleted file mode 100644 index faba75f..0000000 --- a/powertop-2.3-ondemand-check.patch +++ /dev/null @@ -1,42 +0,0 @@ -diff -up powertop-2.3/src/tuning/cpufreq.cpp.orig powertop-2.3/src/tuning/cpufreq.cpp ---- powertop-2.3/src/tuning/cpufreq.cpp.orig 2013-01-31 22:39:27.000000000 +0100 -+++ powertop-2.3/src/tuning/cpufreq.cpp 2013-06-28 14:05:04.254925669 +0200 -@@ -63,6 +63,7 @@ int cpufreq_tunable::good_bad(void) - - char gov[1024]; - int ret = TUNE_GOOD; -+ unsigned long int ld; - - - gov[0] = 0; -@@ -91,6 +92,30 @@ int cpufreq_tunable::good_bad(void) - if (strcmp(gov, line)) - ret = TUNE_BAD; - fclose(file); -+ -+ /* check if ondemand governor is available */ -+ sprintf(filename, "/sys/devices/system/cpu/%s/cpufreq/scaling_available_governors", dirent->d_name); -+ file = fopen(filename, "r"); -+ if (!file) -+ continue; -+ memset(line, 0, 1024); -+ if (fgets(line, 1023,file)==NULL || strstr(line, "ondemand")==NULL) { -+ fclose(file); -+ continue; -+ } -+ fclose(file); -+ -+ /* check if cpu transition latency is not higher than ondemand governor max_transition_latency */ -+ sprintf(filename, "/sys/devices/system/cpu/%s/cpufreq/cpuinfo_transition_latency", dirent->d_name); -+ file = fopen(filename, "r"); -+ if (!file) -+ continue; -+ if (fscanf(file, "%lu", &ld) != 1 || ld > 10000000) -+ { -+ fclose(file); -+ continue; -+ } -+ fclose(file); - } - - closedir(dir); diff --git a/powertop-2.3-man-fix.patch b/powertop-2.6.1-man-fix.patch similarity index 94% rename from powertop-2.3-man-fix.patch rename to powertop-2.6.1-man-fix.patch index 18ed664..741b4a2 100644 --- a/powertop-2.3-man-fix.patch +++ b/powertop-2.6.1-man-fix.patch @@ -9,5 +9,5 @@ diff -up powertop-2.3/doc/powertop.8.orig powertop-2.3/doc/powertop.8 +file to execute for workload. +.TP \fB\-\-quiet - supress stderr output. + suppress stderr output. .TP diff --git a/powertop-2.5-tunable-overflow-fix.patch b/powertop-2.6.1-tunable-overflow-fix.patch similarity index 80% rename from powertop-2.5-tunable-overflow-fix.patch rename to powertop-2.6.1-tunable-overflow-fix.patch index 9b4628c..7e61cad 100644 --- a/powertop-2.5-tunable-overflow-fix.patch +++ b/powertop-2.6.1-tunable-overflow-fix.patch @@ -3,7 +3,7 @@ index e0bdf12..01c673d 100644 --- a/src/tuning/bluetooth.cpp +++ b/src/tuning/bluetooth.cpp @@ -46,8 +46,8 @@ - bt_tunable::bt_tunable(void) : tunable("", 1.0, "Good", "Bad", "Unknown") + bt_tunable::bt_tunable(void) : tunable("", 1.0, _("Good"), _("Bad"), _("Unknown")) { sprintf(desc, _("Bluetooth device interface status")); - strcpy(toggle_bad, "/usr/sbin/hciconfig hci0 up &> /dev/null &"); @@ -25,51 +25,6 @@ index e0bdf12..01c673d 100644 } -diff --git a/src/tuning/cpufreq.cpp b/src/tuning/cpufreq.cpp -index c169e6e..f696c89 100644 ---- a/src/tuning/cpufreq.cpp -+++ b/src/tuning/cpufreq.cpp -@@ -189,7 +189,7 @@ const char *cpufreq_tunable::toggle_script(void) { - int good; - good = good_bad(); - -- strcpy(toggle_good, "/sbin/modprobe cpufreq_ondemand > /dev/null 2>&1\n"); -+ toggle_good = "/sbin/modprobe cpufreq_ondemand > /dev/null 2>&1\n"; - - if (good == TUNE_GOOD) { - dir = opendir("/sys/devices/system/cpu"); -@@ -202,12 +202,12 @@ const char *cpufreq_tunable::toggle_script(void) { - sprintf(filename, "/sys/devices/system/cpu/%s/cpufreq/scaling_governor", dirent->d_name); - if (stat(filename, &statbuf) == -1) - continue; -- sprintf(tmp, "echo '%s' > '%s';\n", original, filename); -- strcat(toggle_good, tmp); -+ snprintf(tmp, 4096, "echo '%s' > '%s';\n", original, filename); -+ toggle_good += tmp; - } - - closedir(dir); -- return toggle_good; -+ return toggle_good.c_str(); - } - - dir = opendir("/sys/devices/system/cpu"); -@@ -220,12 +220,12 @@ const char *cpufreq_tunable::toggle_script(void) { - sprintf(filename, "/sys/devices/system/cpu/%s/cpufreq/scaling_governor", dirent->d_name); - if (stat(filename, &statbuf) == -1) - continue; -- sprintf(tmp, "echo 'ondemand' > '%s';\n", filename); -- strcat(toggle_good, tmp); -+ snprintf(tmp, 4096, "echo 'ondemand' > '%s';\n", filename); -+ toggle_good += tmp; - } - - closedir(dir); -- return toggle_good; -+ return toggle_good.c_str(); - } - - diff --git a/src/tuning/ethernet.cpp b/src/tuning/ethernet.cpp index 3d36112..f3f0224 100644 --- a/src/tuning/ethernet.cpp diff --git a/powertop.spec b/powertop.spec index 7d21f24..a5fee97 100644 --- a/powertop.spec +++ b/powertop.spec @@ -1,6 +1,6 @@ Name: powertop -Version: 2.5 -Release: 2%{?dist} +Version: 2.6.1 +Release: 1%{?dist} Summary: Power consumption monitor Group: Applications/System @@ -11,10 +11,8 @@ Source0: http://01.org/powertop/sites/default/files/downloads/%{name}-%{v # Sent upstream Patch0: powertop-2.3-always-create-params.patch # Sent upstream (http://github.com/fenrus75/powertop/pull/11) -Patch1: powertop-2.3-man-fix.patch -# Sent upstream (http://github.com/fenrus75/powertop/pull/12) -Patch2: powertop-2.3-ondemand-check.patch -Patch3: powertop-2.5-tunable-overflow-fix.patch +Patch1: powertop-2.6.1-man-fix.patch +Patch3: powertop-2.6.1-tunable-overflow-fix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: gettext, ncurses-devel, pciutils-devel, zlib-devel, libnl3-devel Requires(post): coreutils @@ -27,7 +25,6 @@ computer use more power than necessary while it is idle. %setup -q %patch0 -p1 -b .always-create-params %patch1 -p1 -b .man-fix -%patch2 -p1 -b .ondemand-check %patch3 -p1 -b .tunable-overfow-fix # remove left over object files @@ -61,6 +58,11 @@ rm -rf %{buildroot} %{_mandir}/man8/powertop.8* %changelog +* Mon May 26 2014 Jaroslav Škarvada - 2.6.1-1 +- New version + Resolves: rhbz#1100724 +- Dropped ondemand-check patch (upstream dropped the functionality) + * Tue Mar 25 2014 Jaroslav Škarvada - 2.5-2 - Fixed buffer overflow in cpufreq tunables on systems with many CPUs (by tunable-overflow-fix patch) diff --git a/sources b/sources index 9598d8a..335b445 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -806bbcbd44fcea1f807c9582fc1f7d3e powertop-2.5.tar.gz +705e091fa9e79a12d16bc3cb0c688280 powertop-2.6.1.tar.gz