[packages/memstat] Up to 1.2

arekm arekm at pld-linux.org
Sat Nov 28 17:46:22 CET 2026


commit 02b015e6e7bfe953a02cac97b58642d4c4825b32
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Fri Nov 27 16:14:56 2026 +0100

    Up to 1.2
    
    Fix writing linkname[-1] when readlink of /proc/PID/exe fails.

 memstat-linkname.patch | 18 ++++++++++++++++++
 memstat-make.patch     | 22 ----------------------
 memstat.spec           | 18 +++++++++++-------
 3 files changed, 29 insertions(+), 29 deletions(-)
---
diff --git a/memstat.spec b/memstat.spec
index ae714dd..b475130 100644
--- a/memstat.spec
+++ b/memstat.spec
@@ -1,14 +1,16 @@
 Summary:	Identify what's using up virtual memory
 Summary(pl.UTF-8):	Identyfikacja procesów korzystających z pamięci wirtualnej
 Name:		memstat
-Version:	0.9
-Release:	2
+Version:	1.2
+Release:	1
 License:	GPL v2
 Group:		Applications
-Source0:	http://ftp.debian.org/debian/pool/main/m/memstat/%{name}_%{version}.tar.gz
-# Source0-md5:	b4ee74125d9da23d64646f5feee4b149
-Patch0:		%{name}-make.patch
+Source0:	http://ftp.debian.org/debian/pool/main/m/memstat/%{name}_%{version}.tar.xz
+# Source0-md5:	49bf5aa5f3006310e547a13b3275389a
+Patch0:		%{name}-linkname.patch
 URL:		http://packages.qa.debian.org/m/memstat.html
+BuildRequires:	tar >= 1:1.22
+BuildRequires:	xz
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -24,18 +26,20 @@ współdzielona jest wykorzystywana i jakie starsze wersje bibliotek są
 załadowane.
 
 %prep
-%setup -q -n %{name}tool
+%setup -q -n %{name}
 %patch -P0 -p1
 
 %build
 %{__make} \
 	CC="%{__cc}" \
-	CFLAGS="%{rpmcflags}"
+	CFLAGS="%{rpmcflags}" \
+	LDFLAGS="%{rpmldflags}"
 
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_bindir},%{_sysconfdir},%{_mandir}/man1}
 %{__make} install \
+	INSTALL_PROGRAM="install -p -m 755" \
 	DESTDIR=$RPM_BUILD_ROOT
 
 cp -a %{name}.1 $RPM_BUILD_ROOT%{_mandir}/man1
diff --git a/memstat-linkname.patch b/memstat-linkname.patch
new file mode 100644
index 0000000..6911551
--- /dev/null
+++ b/memstat-linkname.patch
@@ -0,0 +1,18 @@
+# readlink() failure made linkname[-1] get written; full-length target overflowed linkname
+--- memstat-1.2/memstat.c.orig
++++ memstat-1.2/memstat.c
+@@ -270,11 +270,11 @@
+ 
+ 	pid = maptab_data[offs].pid;
+ 	sprintf(filename, "/proc/%d/exe", pid);
+-	if ((len = readlink(filename, linkname, PATH_MAX)) == -1) {
++	if ((len = readlink(filename, linkname, PATH_MAX - 1)) == -1) {
+ 	    fprintf(stderr, "Cannot read link information for %s\n", filename);
+ 	    deleted = 1;
+-	}
+-	linkname[len] = '\0';
++	} else
++	    linkname[len] = '\0';
+ 	total = 0;
+ 	for (scan = offs; scan < maptab_fill; scan++) {
+ 	    m = maptab_data + scan;
diff --git a/memstat-make.patch b/memstat-make.patch
deleted file mode 100644
index ca5d3a6..0000000
--- a/memstat-make.patch
+++ /dev/null
@@ -1,22 +0,0 @@
---- ./Makefile.orig	2008-10-20 19:08:27.029556235 +0300
-+++ ./Makefile	2008-10-20 19:08:27.029556235 +0300
-@@ -8,15 +8,15 @@
- exec_prefix = $(prefix)/usr
- 
- INSTALL = install
--INSTALL_PROGRAM = $(INSTALL) -p    -o root -g root  -m  755
--INSTALL_FILE    = $(INSTALL) -p    -o root -g root  -m  644
--INSTALL_DIR     = $(INSTALL) -p -d -o root -g root  -m  755
-+INSTALL_PROGRAM = $(INSTALL) -p      -m  755
-+INSTALL_FILE    = $(INSTALL) -p      -m  644
-+INSTALL_DIR     = $(INSTALL) -p -d   -m  755
- 
- ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -g
- endif
- ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
--INSTALL_PROGRAM += -s
-+INSTALL_PROGRAM += 
- endif
- 
- memstat: memstat.c
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/memstat.git/commitdiff/02b015e6e7bfe953a02cac97b58642d4c4825b32



More information about the pld-cvs-commit mailing list