Accepting request 481739 from GNOME:Factory

Update to 3.24.0 (forwarded request 481701 from dimstar)

OBS-URL: https://build.opensuse.org/request/show/481739
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libgtop?expand=0&rev=55
This commit is contained in:
Dominique Leuenberger 2017-03-22 22:13:48 +00:00 committed by Git OBS Bridge
commit 94ec23b0c6
5 changed files with 51 additions and 161 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:268ad1478363e8c0955ea842fa134f6eb88965ab5e03166c20d8df9e7a1f8ef8
size 725720

3
libgtop-2.36.0.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:13bfe34c150b2b00b03df4732e8c7ccfae09ab15897ee4f4ebf0d16b0f3ba12b
size 727072

View File

@ -1,137 +0,0 @@
From b22fddaaa5dc3d667f4b5168c7e95979cf8f7910 Mon Sep 17 00:00:00 2001
From: Mike Gorse <mgorse@suse.com>
Date: Wed, 18 Jan 2017 16:40:52 -0600
Subject: [PATCH] linux: Dynamically allocate the buffer to parse /proc/cpuinfo
On a server with many cores, /proc/cpuinfo might contain more than 64k of
data, so we weren't fully parsing it, meaning that we'd see fewer cores than
were present.
https://bugzilla.gnome.org/show_bug.cgi?id=323354
---
sysdeps/linux/glibtop_private.c | 63 +++++++++++++++++++++++++++++++++++++++++
sysdeps/linux/glibtop_private.h | 4 +++
sysdeps/linux/sysinfo.c | 6 ++--
3 files changed, 71 insertions(+), 2 deletions(-)
diff --git a/sysdeps/linux/glibtop_private.c b/sysdeps/linux/glibtop_private.c
index 52c3782..8c50723 100644
--- a/sysdeps/linux/glibtop_private.c
+++ b/sysdeps/linux/glibtop_private.c
@@ -133,7 +133,70 @@ file_to_buffer(glibtop *server, char *buffer, size_t bufsiz, const char *filenam
}
}
+char *file_to_buffer_alloc(const char *format, ...)
+{
+ char path[4096];
+ int fd;
+ char *buffer = NULL;
+ size_t len = 0;
+ size_t bufsiz = 16384;
+ ssize_t nread = 0;
+ va_list pa;
+
+ va_start(pa, format);
+
+ /* C99 also provides vsnprintf */
+ g_vsnprintf(path, sizeof path, format, pa);
+ va_end(pa);
+
+ buffer = (char *)malloc(bufsiz);
+ if (!buffer)
+ return NULL;
+
+ buffer [0] = '\0';
+
+ if((fd = open (path, O_RDONLY)) < 0)
+ return NULL;
+
+ for (;;) {
+ nread = read (fd, buffer + len, bufsiz - len - 1);
+
+ if (G_UNLIKELY(nread < 0)) {
+ if (errno == EINTR)
+ continue;
+ else
+ break;
+ }
+
+ len += nread;
+
+ if (nread == 0)
+ break;
+
+ if (len >= bufsiz - 1) {
+ char *new;
+ bufsiz *= 2;
+ new = realloc (buffer, bufsiz);
+ if (!new) {
+ free (buffer);
+ return NULL;
+ }
+ buffer = new;
+ }
+ }
+
+ close (fd);
+
+ if (nread < 0) {
+ free (buffer);
+ return NULL;
+ }
+
+ buffer [len] = '\0';
+
+ return buffer;
+}
static unsigned long
diff --git a/sysdeps/linux/glibtop_private.h b/sysdeps/linux/glibtop_private.h
index 149832a..0ff2ea0 100644
--- a/sysdeps/linux/glibtop_private.h
+++ b/sysdeps/linux/glibtop_private.h
@@ -78,6 +78,10 @@ file_to_buffer(glibtop *server, char *buffer, size_t bufsiz, const char *filenam
int
try_file_to_buffer(char *buffer, size_t bufsiz, const char *format, ...) G_GNUC_PRINTF(3, 4);
+/* Returns an allocated buffer to be freed with free(), or NULL on error */
+char *
+file_to_buffer_alloc(const char *format, ...) G_GNUC_PRINTF(1, 2);
+
/* some inline functions that wrap proc path
* as fast as macros :)
diff --git a/sysdeps/linux/sysinfo.c b/sysdeps/linux/sysinfo.c
index bd80b0d..14bfd8b 100644
--- a/sysdeps/linux/sysinfo.c
+++ b/sysdeps/linux/sysinfo.c
@@ -36,12 +36,13 @@ static glibtop_sysinfo sysinfo = { .flags = 0 };
static void
init_sysinfo (glibtop *server)
{
- char buffer [65536];
+ char *buffer;
gchar ** processors;
if(G_LIKELY(sysinfo.flags)) return;
- file_to_buffer(server, buffer, sizeof buffer, FILENAME);
+ buffer = file_to_buffer_alloc(FILENAME);
+ if (!buffer) return;
/* cpuinfo records are seperated by a blank line */
processors = g_strsplit(buffer, "\n\n", 0);
@@ -88,6 +89,7 @@ init_sysinfo (glibtop *server)
}
g_strfreev(processors);
+ g_free(buffer);
sysinfo.flags = _glibtop_sysdeps_sysinfo;
}
--
2.6.6

View File

@ -1,3 +1,34 @@
-------------------------------------------------------------------
Tue Mar 21 09:52:56 UTC 2017 - dimstar@opensuse.org
- Update to version 2.36.0:
+ No changes.
-------------------------------------------------------------------
Tue Mar 14 08:48:24 UTC 2017 - zaitor@opensuse.org
- Update to version 2.35.92:
+ Better output format for arrays.
-------------------------------------------------------------------
Thu Mar 2 14:26:43 UTC 2017 - jengelh@inai.de
- Rename %soname to %sover to better reflect its use.
- Redo summaries and RPM groups.
-------------------------------------------------------------------
Wed Feb 15 09:32:12 UTC 2017 - dimstar@opensuse.org
- Update to version 2.35.90:
+ Use dynamically allocated cpu buffer.
+ Do not cache getpagesize().
+ Use faster g_ascii_isspace in tokenization.
+ Ignore paragraphs not describing a CPU/core.
+ Updated translations.
- Drop libgtop-bsc1020294-cpu-buffer.patch: fixed upstream.
- Drop fdupes BuildRequires: it's already not been started and
rpmlint also does not complain about duplicate files.
-------------------------------------------------------------------
Thu Jan 19 17:29:25 UTC 2017 - mgorse@suse.com

View File

@ -17,18 +17,15 @@
Name: libgtop
Version: 2.34.2
Version: 2.36.0
Release: 0
%define soname 10
Summary: LibGTop Library
%define sover 10
Summary: System status information library
License: GPL-2.0+
Group: System/Libraries
Group: Development/Libraries/C and C++
Url: https://developer.gnome.org/libgtop/stable/
Source: http://download.gnome.org/sources/libgtop/2.34/%{name}-%{version}.tar.xz
Source: http://download.gnome.org/sources/libgtop/2.36/%{name}-%{version}.tar.xz
Source99: baselibs.conf
# PATCH-FIX-UPSTREAM libgtop-bsc1020294-cpu-buffer.patch bsc#1020294 bgo#323354 mgorse@suse.com -- dynamically allocate buffer when reading /proc/cpuinfo.
Patch0: libgtop-bsc1020294-cpu-buffer.patch
BuildRequires: fdupes
BuildRequires: glib2-devel
BuildRequires: gobject-introspection-devel
%if !0%{?is_opensuse}
@ -46,8 +43,8 @@ On Linux systems, this information is taken directly from the /proc
file system. On other systems, a server is used to read information
from /dev/kmem.
%package -n libgtop-2_0-%{soname}
Summary: LibGTop Library
%package -n libgtop-2_0-%{sover}
Summary: System status information library
Group: System/Libraries
Recommends: %{name}-lang
# Needed to make lang package installable
@ -59,7 +56,7 @@ Obsoletes: libgtop-64bit
%endif
#
%description -n libgtop-2_0-%{soname}
%description -n libgtop-2_0-%{sover}
A library that fetches information about the running system, such as
CPU and memory usage and active processes.
@ -68,7 +65,7 @@ file system. On other systems, a server is used to read information
from /dev/kmem.
%package -n typelib-1_0-GTop-2_0
Summary: LibGTop Library -- Introspection bindings
Summary: Introspection bindings for libgtop
Group: System/Libraries
%description -n typelib-1_0-GTop-2_0
@ -82,9 +79,9 @@ from /dev/kmem.
This package provides the GObject Introspection bindings for libgtop.
%package devel
Summary: Include Files and Libraries mandatory for Development
Summary: Development files for libgtop
Group: Development/Libraries/GNOME
Requires: libgtop-2_0-%{soname} = %{version}
Requires: libgtop-2_0-%{sover} = %{version}
Requires: typelib-1_0-GTop-2_0 = %{version}
# bug437293
%ifarch ppc64
@ -98,9 +95,9 @@ This package contains all necessary include files and libraries needed
to develop applications that require these.
%package doc
Summary: LibGTop Library
Summary: Documentation for the libgtop library
Group: Development/Libraries/GNOME
Requires: libgtop-2_0-%{soname} = %{version}
Requires: libgtop-2_0-%{sover} = %{version}
PreReq: /sbin/install-info
%description doc
@ -114,7 +111,6 @@ from /dev/kmem.
%lang_package
%prep
%setup -q
%patch0 -p1
%if !0%{?is_opensuse}
translation-update-upstream po libgtop
# rpmlint note: libgtop has a separate translation for both Bengali and Bengali India
@ -123,16 +119,16 @@ translation-update-upstream po libgtop
%build
%configure\
--disable-static
%__make %{?jobs:-j%jobs}
make %{?_smp_mflags}
%install
%makeinstall
find %{buildroot}%{_libdir} -name '*.la' -type f -delete -print
%find_lang %{name} %{?no_lang_C}
%post -n libgtop-2_0-%{soname} -p /sbin/ldconfig
%post -n libgtop-2_0-%{sover} -p /sbin/ldconfig
%postun -n libgtop-2_0-%{soname} -p /sbin/ldconfig
%postun -n libgtop-2_0-%{sover} -p /sbin/ldconfig
%preun doc
%install_info_delete --info-dir=%{_datadir}/info %{_datadir}/info/%{name}2.info.gz
@ -142,7 +138,7 @@ find %{buildroot}%{_libdir} -name '*.la' -type f -delete -print
%files lang -f %{name}.lang
%files -n libgtop-2_0-%{soname}
%files -n libgtop-2_0-%{sover}
%defattr(-, root, root)
%doc AUTHORS COPYING NEWS README copyright.txt
%{_libdir}/*.so.*