[arch-commits] Commit in sysvinit/trunk (80_killall_pidof.patch ChangeLog PKGBUILD)

Eric Bélanger eric at archlinux.org
Thu Apr 30 22:26:00 EDT 2009


    Date: Thursday, April 30, 2009 @ 22:26:00
  Author: eric
Revision: 37188

upgpkg: sysvinit 2.86-5
    Patched pidof to prevent false positives (close FS#14428), FHS man pages, Added url, Added ChangeLog

Added:
  sysvinit/trunk/80_killall_pidof.patch
  sysvinit/trunk/ChangeLog
Modified:
  sysvinit/trunk/PKGBUILD

------------------------+
 80_killall_pidof.patch |  100 +++++++++++++++++++++++++++++++++++++++++++++++
 ChangeLog              |    7 +++
 PKGBUILD               |   32 +++++++--------
 3 files changed, 124 insertions(+), 15 deletions(-)

Added: 80_killall_pidof.patch
===================================================================
--- 80_killall_pidof.patch	                        (rev 0)
+++ 80_killall_pidof.patch	2009-05-01 02:26:00 UTC (rev 37188)
@@ -0,0 +1,100 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 20_pidof.dpatch by Petter Reinholdtsen
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Modify pidof to not print empty line if no pid was found. (bug: #225476)
+
+ at DPATCH@
+diff -urNad trunk~/src/killall5.c trunk/src/killall5.c
+--- trunk~/src/killall5.c	2008-03-26 09:30:38.000000000 +0100
++++ trunk/src/killall5.c	2008-03-26 09:31:14.000000000 +0100
+@@ -378,8 +378,8 @@
+ 	int		foundone = 0;
+ 	int		ok = 0;
+ 
+-	/* Try to stat the executable. */
+-	if (prog[0] == '/' && stat(prog, &st) == 0) dostat++;
++	if (! prog)
++		return NULL;
+ 
+ 	/* Get basename of program. */
+ 	if ((s = strrchr(prog, '/')) == NULL)
+@@ -387,9 +387,16 @@
+ 	else
+ 		s++;
+ 
++	if (! *s)
++		return NULL;
++
+ 	q = (PIDQ_HEAD *)xmalloc(sizeof(PIDQ_HEAD));
+ 	q = init_pid_q(q);
+ 
++	/* Try to stat the executable. */
++	if (prog[0] == '/' && stat(prog, &st) == 0)
++		dostat++;
++
+ 	/* First try to find a match based on dev/ino pair. */
+ 	if (dostat) {
+ 		for (p = plist; p; p = p->next) {
+@@ -404,15 +411,35 @@
+ 	if (!foundone) for (p = plist; p; p = p->next) {
+ 		ok = 0;
+ 
+-		/* Compare name (both basename and full path) */
+-		ok += (p->argv0 && strcmp(p->argv0, prog) == 0);
+-		ok += (p->argv0 && strcmp(p->argv0base, s) == 0);
++		/*             matching        nonmatching
++		 * proc name   prog name       prog name
++		 * ---         -----------     ------------
++		 *   b         b, p/b, q/b
++		 * p/b         b, p/b          q/b
++		 *
++		 * Algorithm: Match if:
++		 *    cmd = arg
++		 * or cmd = base(arg)
++		 * or base(cmd) = arg
++		 *
++		 * Specifically, do not match just because base(cmd) = base(arg)
++		 * as was done in earlier versions of this program, since this
++		 * allows /aaa/foo to match /bbb/foo .
++		 */
++		ok |=
++			(p->argv0 && strcmp(p->argv0, prog) == 0)
++			|| (p->argv0 && s != prog && strcmp(p->argv0, s) == 0)
++			|| (p->argv0base && strcmp(p->argv0base, prog) == 0);
+ 
+ 		/* For scripts, compare argv[1] as well. */
+-		if (scripts_too && p->argv1 &&
+-		    !strncmp(p->statname, p->argv1base, STATNAMELEN)) {
+-			ok += (strcmp(p->argv1, prog) == 0);
+-			ok += (strcmp(p->argv1base, s) == 0);
++		if (
++			scripts_too && p->statname && p->argv1base
++			&& !strncmp(p->statname, p->argv1base, STATNAMELEN)
++		) {
++			ok |=
++				(p->argv1 && strcmp(p->argv1, prog) == 0)
++				|| (p->argv1 && s != prog && strcmp(p->argv1, s) == 0)
++				|| (p->argv1base && strcmp(p->argv1base, prog) == 0);
+ 		}
+ 
+ 		/*
+@@ -423,7 +450,7 @@
+ 		    (p->argv0 == NULL ||
+ 		     p->argv0[0] == 0 ||
+ 		     strchr(p->argv0, ' '))) {
+-			ok += (strcmp(p->statname, s) == 0);
++			ok |= (strcmp(p->statname, s) == 0);
+ 		}
+ 		if (ok) add_pid_to_q(q, p);
+ 	}
+@@ -548,7 +575,8 @@
+ 			}
+ 		}
+ 	}
+-	printf("\n");
++	if (!first)
++		printf("\n");
+ 	closelog();
+ 	return(first ? 1 : 0);
+ }

Added: ChangeLog
===================================================================
--- ChangeLog	                        (rev 0)
+++ ChangeLog	2009-05-01 02:26:00 UTC (rev 37188)
@@ -0,0 +1,7 @@
+2009-04-29  Eric Belanger  <eric at archlinux.org>
+
+	* sysvinit 2.86-5
+	* Patched pidof to prevent false positives (close FS#14428)
+	* FHS man pages
+	* Added url
+	* Added ChangeLog

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2009-05-01 01:18:32 UTC (rev 37187)
+++ PKGBUILD	2009-05-01 02:26:00 UTC (rev 37188)
@@ -1,26 +1,28 @@
 # $Id$
-# Maintainer: judd <jvinet at zeroflux.org>
+# Maintainer: Eric Belanger <eric at archlinux.org>
+# Contributor: judd <jvinet at zeroflux.org>
+
 pkgname=sysvinit
 pkgver=2.86
-pkgrel=4
+pkgrel=5
 pkgdesc="Linux System V Init"
-arch=(i686 x86_64)
+arch=('i686' 'x86_64')
+url="http://freshmeat.net/projects/sysvinit/"
 license=('GPL')
 groups=('base')
 depends=('shadow' 'util-linux' 'coreutils' 'glibc' 'awk')
-source=(ftp://ftp.cistron.nl/pub/people/miquels/$pkgname/$pkgname-$pkgver.tar.gz)
-md5sums=('7d5d61c026122ab791ac04c8a84db967')
+source=(ftp://ftp.cistron.nl/pub/people/miquels/${pkgname}/${pkgname}-${pkgver}.tar.gz \
+        80_killall_pidof.patch)
+md5sums=('7d5d61c026122ab791ac04c8a84db967' '3d65ca1e0c47648d1d58cd2af29a1ea4')
 
 build() {
-  cd $startdir/src/$pkgname-$pkgver
-  cp src/init.c src/init.c.backup
-  sed 's/\(.*\)\(Sending processes\)\(.*\)/\1\2 started by init\3/' \
-     src/init.c > tmp~
-  mv tmp~ src/init.c
-  mkdir -p $startdir/pkg/bin $startdir/pkg/sbin
-  mkdir -p $startdir/pkg/usr/bin
-  mkdir -p $startdir/pkg/usr/man/man5 $startdir/pkg/usr/man/man8
-  mkdir -p $startdir/pkg/usr/man/man1 $startdir/pkg/usr/include
+  cd ${srcdir}/${pkgname}-${pkgver}
+  patch -p1 < ../80_killall_pidof.patch || return 1
+  cp src/init.c src/init.c.backup || return 1
+  sed -i 's/\(.*\)\(Sending processes\)\(.*\)/\1\2 started by init\3/' src/init.c || return 1
+  install -d ${pkgdir}/{bin,sbin}
+  install -d ${pkgdir}/usr/{bin,include}
+  install -d ${pkgdir}/usr/share/man/man{1,5,8}
   make -C src || return 1
-  make -C src MANDIR=/usr/man ROOT=$startdir/pkg install
+  make -C src ROOT=${pkgdir} install || return 1
 }



More information about the arch-commits mailing list