Hello community,

here is the log from the commit of package powerpc-utils for openSUSE:Factory 
checked in at 2016-09-23 11:24:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/powerpc-utils (Old)
 and      /work/SRC/openSUSE:Factory/.powerpc-utils.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "powerpc-utils"

Changes:
--------
--- /work/SRC/openSUSE:Factory/powerpc-utils/powerpc-utils.changes      
2016-07-27 16:30:15.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.powerpc-utils.new/powerpc-utils.changes 
2016-09-23 11:24:03.000000000 +0200
@@ -1,0 +2,9 @@
+Mon Sep 12 12:34:45 CEST 2016 - [email protected]
+
+- Include the following new patches (bsc#998330):
+  powerpc-utils-fix_integer_to_float_cast.patch
+  powerpc-utils-Include_GPL_header.patch
+  powerpc-utils-lparstat_Fix_segfault_when_parsing_proc_interrupts.patch
+  
powerpc-utils-lparstat_Ignore_whitespace_at_beginning_of_proc_interrupts_SPU_line.patch
+
+-------------------------------------------------------------------

New:
----
  powerpc-utils-Include_GPL_header.patch
  powerpc-utils-fix_integer_to_float_cast.patch
  powerpc-utils-lparstat_Fix_segfault_when_parsing_proc_interrupts.patch
  
powerpc-utils-lparstat_Ignore_whitespace_at_beginning_of_proc_interrupts_SPU_line.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ powerpc-utils.spec ++++++
--- /var/tmp/diff_new_pack.2fqZVY/_old  2016-09-23 11:24:04.000000000 +0200
+++ /var/tmp/diff_new_pack.2fqZVY/_new  2016-09-23 11:24:04.000000000 +0200
@@ -30,6 +30,10 @@
 Patch2:         ofpathname_powernv.patch
 Patch3:         systemd-dir.patch
 Patch4:         libvirt-service-dep.patch
+Patch5:         powerpc-utils-fix_integer_to_float_cast.patch
+Patch6:         powerpc-utils-Include_GPL_header.patch
+Patch7:         
powerpc-utils-lparstat_Fix_segfault_when_parsing_proc_interrupts.patch
+Patch8:         
powerpc-utils-lparstat_Ignore_whitespace_at_beginning_of_proc_interrupts_SPU_line.patch
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  librtas-devel
@@ -59,6 +63,10 @@
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
 
 %build
 autoreconf -fvi

++++++ powerpc-utils-Include_GPL_header.patch ++++++
commit ce767e7a7254e5dd38655b67e31a7b337df5d68e
Author: John Allen <[email protected]>
Date:   Fri Aug 26 15:26:12 2016 -0400

    drmgr: Include GPL header in prrn.c
    
    Add GPL boilerplate to prrn.c for consistency with other files in
    powerpc-utils.
    
    Signed-off-by: John Allen <[email protected]>

diff --git a/src/drmgr/prrn.c b/src/drmgr/prrn.c
index 7ce6a14..5c9f206 100644
--- a/src/drmgr/prrn.c
+++ b/src/drmgr/prrn.c
@@ -1,3 +1,21 @@
+/**
+ * Copyright (c) 2016 International Business Machines
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 
USA.
+ */
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
++++++ powerpc-utils-fix_integer_to_float_cast.patch ++++++
commit c61535c62111d04a886a2b4d7613b7006d5fe209
Author: John Allen <[email protected]>
Date:   Thu Aug 11 16:30:12 2016 -0400

    lparstat: Fix bad cast from integer to float
    
    Fix a bug where the cpu stats (%user, %sys, %wait, and %idle) do not add
    up to 100%. The problem was that we were casting the cpu stats and the
    total cpu time to floats from ints. For large integer values, this would
    cause the floating point representation to be truncated. This solution
    avoids the casts and stores the cpu stats as long longs and only casts
    'total' to a long double in order to perform floating point division.
    
    Additionally, this patch parses the proc stat values as long longs as
    on systems that have been running for a long time, these values can exceed
    the maximum 32 bit integer limit.
    
    Signed-off-by: John Allen <[email protected]>

diff --git a/src/lparstat.c b/src/lparstat.c
index ebe0d13..bd4ff58 100644
--- a/src/lparstat.c
+++ b/src/lparstat.c
@@ -264,11 +264,11 @@ int parse_proc_stat()
        statvals[0] = 0;
        value = line;
        for (i = 1; i <= (entries - 1); i++) {
-               int v;
+               long long v;
                value = strchr(value, ' ') + 1;
                if (i == 1)
                        value++;
-               v = atoi(value);
+               v = atoll(value);
                statvals[i] = v;
                statvals[0] += v;
        }
@@ -465,13 +465,13 @@ long long get_cpu_time_diff()
 
 void get_cpu_stat(struct sysentry *se, char *buf)
 {
-       float total, percent;
-       float old_val, new_val;
+       float percent;
+       long long total, old_val, new_val;
 
        total = get_cpu_time_diff();
-       new_val = atoi(se->value);
-       old_val = atoi(se->old_value);
-       percent = (float)((new_val - old_val)/total) * 100;
+       new_val = atoll(se->value);
+       old_val = atoll(se->old_value);
+       percent = ((new_val - old_val)/(long double)total) * 100;
        sprintf(buf, "%.2f", percent);
 }
 
++++++ powerpc-utils-lparstat_Fix_segfault_when_parsing_proc_interrupts.patch 
++++++
commit 3c3a53825248e1ef52ee203c968f643c26820cc5
Author: John Allen <[email protected]>
Date:   Tue Aug 23 11:23:31 2016 -0400

    lparstat: Fix segfault when parsing /proc/interrupts
    
    Fix a bug where we hit a segfault running 'lparstat -i' on machines with a
    large number of cpus. The 'SPU' line in proc interrupts would exceed the
    512B allocated and we would subsequently walk off the end of the array
    when we attempt to parse the line. This solution uses getline instead of
    fgets in order to easily handle lines of arbitrary length.
    
    Signed-off-by: John Allen <[email protected]>

diff --git a/src/lparstat.c b/src/lparstat.c
index bd4ff58..200fced 100644
--- a/src/lparstat.c
+++ b/src/lparstat.c
@@ -203,7 +203,8 @@ int parse_lparcfg()
 int parse_proc_ints()
 {
        FILE *f;
-       char line[512];
+       char *line;
+       size_t n = 0;
        char *value;
        struct sysentry *se;
        long long int phint = 0;
@@ -214,7 +215,7 @@ int parse_proc_ints()
                return -1;
        }
 
-       while (fgets(line, 512, f) != NULL) {
+       while (getline(&line, &n, f) != -1) {
                /* we just need the SPU line */
                if (line[0] != 'S' || line[1] != 'P' || line[2] != 'U')
                        continue;
@@ -224,8 +225,11 @@ int parse_proc_ints()
                        v = atoi(value);
                        phint += v;
                }
+
+               break;
        }
 
+       free(line);
        fclose(f);
 
        se = get_sysentry("phint");
++++++ 
powerpc-utils-lparstat_Ignore_whitespace_at_beginning_of_proc_interrupts_SPU_line.patch
 ++++++
commit b071e81d8cd71af496d5c5b36371c30449051def
Author: John Allen <[email protected]>
Date:   Fri Aug 26 15:29:58 2016 -0400

    lparstat: Ignore whitespace at beginning of /proc/interrupts SPU line
    
    In the case that any interrupt number in /proc/interrupts exceeds 3
    characters, whitespace will be placed at the beginning of the SPU line in
    order to keep the columns aligned. In that case, the current code will miss
    the SPU line. This patch skips any whitespace preceding the SPU line.
    
    Signed-off-by: John Allen <[email protected]>

diff --git a/src/lparstat.c b/src/lparstat.c
index 200fced..f32b4ab 100644
--- a/src/lparstat.c
+++ b/src/lparstat.c
@@ -203,7 +203,7 @@ int parse_lparcfg()
 int parse_proc_ints()
 {
        FILE *f;
-       char *line;
+       char *line, *p;
        size_t n = 0;
        char *value;
        struct sysentry *se;
@@ -216,11 +216,15 @@ int parse_proc_ints()
        }
 
        while (getline(&line, &n, f) != -1) {
+               p = line;
+               while (*p == ' ')
+                       p++;
+
                /* we just need the SPU line */
-               if (line[0] != 'S' || line[1] != 'P' || line[2] != 'U')
+               if (p[0] != 'S' || p[1] != 'P' || p[2] != 'U')
                        continue;
 
-               for (value = &line[5]; value[2] != 'S'; value += 11) {
+               for (value = &p[5]; value[2] != 'S'; value += 11) {
                        int v;
                        v = atoi(value);
                        phint += v;

Reply via email to