[sysvinit] rebase to sysvinit-2.88dsf

Petr Lautrbach plautrba at fedoraproject.org
Thu Oct 21 14:35:59 UTC 2010


commit f049debf04924c623935bc6bc3dee501af553b06
Author: Petr Lautrbach <plautrba at redhat.com>
Date:   Thu Oct 21 13:55:49 2010 +0200

    rebase to sysvinit-2.88dsf

 sysvinit-2.86-pidof-man.patch                      |   16 --
 sysvinit-2.87-omit.patch                           |  179 --------------------
 sysvinit-2.87-pidof.patch                          |  107 ------------
 sysvinit-2.87-sulogin.patch                        |   12 --
 sysvinit-2.87-wide.patch                           |  119 -------------
 ...nit-2.87-ipv6.patch => sysvinit-2.88-ipv6.patch |    6 +-
 sysvinit-2.88-omit.patch                           |  169 ++++++++++++++++++
 ...t-2.86-quiet.patch => sysvinit-2.88-quiet.patch |   20 ++-
 sysvinit.spec                                      |   31 ++---
 9 files changed, 194 insertions(+), 465 deletions(-)
---
diff --git a/sysvinit-2.87-ipv6.patch b/sysvinit-2.88-ipv6.patch
similarity index 87%
rename from sysvinit-2.87-ipv6.patch
rename to sysvinit-2.88-ipv6.patch
index 25964c3..c3c33a7 100644
--- a/sysvinit-2.87-ipv6.patch
+++ b/sysvinit-2.88-ipv6.patch
@@ -1,8 +1,8 @@
 diff --git a/src/last.c b/src/last.c
-index 06bba47..09241ef 100644
+index 5003c7c..02103e0 100644
 --- a/src/last.c
 +++ b/src/last.c
-@@ -309,30 +309,22 @@ int dns_lookup(char *result, int size, int useip, int32_t *a)
+@@ -318,30 +318,22 @@ int dns_lookup(char *result, int size, int useip, int32_t *a)
  	struct sockaddr_in6	sin6;
  	struct sockaddr		*sa;
  	int			salen, flags;
@@ -25,7 +25,7 @@ index 06bba47..09241ef 100644
  	 *
  	 *	Ugly.
  	 */
- 	if (a[0] == 0 && a[1] == 0 && a[2] == htonl (0xffff))
+ 	if (a[0] == 0 && a[1] == 0 && a[2] == (int32_t)htonl (0xffff))
  		mapped = 1;
 -	topnibble = ntohl((unsigned int)a[0]) >> 28;
  
diff --git a/sysvinit-2.88-omit.patch b/sysvinit-2.88-omit.patch
new file mode 100644
index 0000000..292bbae
--- /dev/null
+++ b/sysvinit-2.88-omit.patch
@@ -0,0 +1,169 @@
+diff --git a/man/pidof.8 b/man/pidof.8
+index 276a93c..ac5f58a 100644
+--- a/man/pidof.8
++++ b/man/pidof.8
+@@ -24,6 +24,7 @@ pidof -- find the process ID of a running program.
+ .RB [ \-c ]
+ .RB [ \-n ]
+ .RB [ \-x ]
++.RB [ \-m ]
+ .RB [ \-o
+ .IR omitpid[,omitpid..] ]
+ .RB [ \-o
+@@ -63,6 +64,11 @@ shells running the named scripts.
+ Tells \fIpidof\fP to omit processes with that process id. The special
+ pid \fB%PPID\fP can be used to name the parent process of the \fIpidof\fP
+ program, in other words the calling shell or shell script.
++.IP -m
++When used with -o, will also omit any processes that have the same
++argv[0] and argv[1] as any explicitly omitted process ids. This can be
++used to avoid multiple shell scripts concurrently calling pidof returning
++each other's pids.
+ .SH "EXIT STATUS"
+ .TP
+ .B 0
+diff --git a/src/killall5.c b/src/killall5.c
+index 5937d98..e73885e 100644
+--- a/src/killall5.c
++++ b/src/killall5.c
+@@ -118,6 +118,7 @@ typedef struct _s_nfs
+ 
+ /* List of processes. */
+ PROC *plist;
++PROC *olist;
+ 
+ /* List of processes to omit. */
+ OMIT *omit;
+@@ -345,6 +346,20 @@ static void clear_mnt(void)
+ 	}
+ }
+ 
++static void clear_omit(void)
++{
++	OMIT *o;
++	PROC *p;
++	for (o = omit; o; o = omit) {
++		omit = omit->next;
++		free(o);
++	}
++	for (p = olist; p; p = olist) {
++		olist = olist->next;
++		free(p);
++	}
++}
++
+ /*
+  *     Check if path is ia shadow off a NFS partition.
+  */
+@@ -452,6 +467,7 @@ int readproc(int do_stat)
+ 	DIR		*dir;
+ 	FILE		*fp;
+ 	PROC		*p, *n;
++	OMIT		*o, *m;
+ 	struct dirent	*d;
+ 	struct stat	st;
+ 	char		path[PATH_MAX+1];
+@@ -624,6 +640,17 @@ int readproc(int do_stat)
+ 		p->next = plist;
+ 		plist = p;
+ 		p->pid = pid;
++		/* Could be smarter, but it's a small list. */
++		m = omit;
++		for (o = omit; m; o = m) {
++			m = o->next;
++			if (o->pid == p->pid) {
++				n = (PROC*)xmalloc(sizeof(PROC));
++				*n = *p;
++				n->next = olist;
++				olist = n;
++			}
++		}
+ 	}
+ 	closedir(dir);
+ 
+@@ -813,6 +840,26 @@ PIDQ_HEAD *pidof(char *prog)
+ 	return q;
+ }
+ 
++int matches(PROC *o, PROC *p)
++{
++	int ret = 0;
++	char *oargv1, *pargv1;
++	if ((o->argv0 && p->argv0 && !strcmp(o->argv0,p->argv0))) {
++		if (o->argv1 && p->argv1) {
++			if ((oargv1 = canonicalize_file_name(o->argv1)) == NULL)
++				oargv1 = strdup(o->argv1);
++			if ((pargv1 = canonicalize_file_name(p->argv1)) == NULL)
++				pargv1 = strdup(p->argv1);
++			if (! strcmp(oargv1, pargv1)) {
++				ret = 1;
++			}
++			free(oargv1);
++			free(pargv1);
++		}
++	}
++	return ret;
++}
++
+ /* Give usage message and exit. */
+ void usage(void)
+ {
+@@ -845,6 +892,7 @@ void nsyslog(int pri, char *fmt, ...)
+ #define PIDOF_SINGLE	0x01
+ #define PIDOF_OMIT	0x02
+ #define PIDOF_NETFS	0x04
++#define PIDOF_OMIT_OMIT_MATCHES	0x08
+ 
+ /*
+  *	Pidof functionality.
+@@ -861,6 +909,7 @@ int main_pidof(int argc, char **argv)
+ 	struct stat	st;
+ 	char		tmp[512];
+ 
++	olist = (PROC*)0;
+ 	omit = (OMIT*)0;
+ 	nlist = (NFS*)0;
+ 	opterr = 0;
+@@ -868,7 +917,7 @@ int main_pidof(int argc, char **argv)
+ 	if ((token = getenv("PIDOF_NETFS")) && (strcmp(token,"no") != 0))
+ 		flags |= PIDOF_NETFS;
+ 
+-	while ((opt = getopt(argc,argv,"hco:sxn")) != EOF) switch (opt) {
++	while ((opt = getopt(argc,argv,"hcmo:sxn")) != EOF) switch (opt) {
+ 		case '?':
+ 			nsyslog(LOG_ERR,"invalid options on command line!\n");
+ 			closelog();
+@@ -907,6 +956,9 @@ int main_pidof(int argc, char **argv)
+ 		case 'x':
+ 			scripts_too++;
+ 			break;
++		case 'm':
++			flags |= PIDOF_OMIT_OMIT_MATCHES;
++			break;
+ 		case 'n':
+ 			flags |= PIDOF_NETFS;
+ 			break;
+@@ -938,10 +990,13 @@ int main_pidof(int argc, char **argv)
+ 			pid_t spid = 0;
+ 			while ((p = get_next_from_pid_q(q))) {
+ 				if ((flags & PIDOF_OMIT) && omit) {
+-					OMIT * optr;
+-					for (optr = omit; optr; optr = optr->next) {
++					PROC * optr;
++					for (optr = olist; optr; optr = optr->next) {
+ 						if (optr->pid == p->pid)
+ 							break;
++						if (flags & PIDOF_OMIT_OMIT_MATCHES)
++							if (matches(optr, p))
++								break;
+ 					}
+ 
+ 					/*
+@@ -977,6 +1032,7 @@ int main_pidof(int argc, char **argv)
+ 	if (!first)
+ 		printf("\n");
+ 
++	clear_omit();
+ 	clear_mnt();
+ 
+ 	closelog();
diff --git a/sysvinit-2.86-quiet.patch b/sysvinit-2.88-quiet.patch
similarity index 62%
rename from sysvinit-2.86-quiet.patch
rename to sysvinit-2.88-quiet.patch
index e5bd058..f30bc53 100644
--- a/sysvinit-2.86-quiet.patch
+++ b/sysvinit-2.88-quiet.patch
@@ -1,6 +1,8 @@
---- sysvinit-2.86/src/init.c.silence	2006-08-08 20:50:37.000000000 -0400
-+++ sysvinit-2.86/src/init.c	2006-08-08 20:54:24.000000000 -0400
-@@ -117,6 +117,7 @@
+diff --git a/src/init.c b/src/init.c
+index d2bd121..dc82e28 100644
+--- a/src/init.c
++++ b/src/init.c
+@@ -135,6 +135,7 @@ struct utmp utproto;		/* Only used for sizeof(utproto.ut_id) */
  char *console_dev;		/* Console device. */
  int pipe_fd = -1;		/* /dev/initctl */
  int did_boot = 0;		/* Did we already do BOOT* stuff? */
@@ -8,25 +10,25 @@
  int main(int, char **);
  
  /*	Used by re-exec part */
-@@ -1673,7 +1674,7 @@
+@@ -1800,7 +1801,7 @@ int read_level(int arg)
  			initlog(L_SY, "Trying to re-exec init");
  			return 'U';
  		default:
 -		  	initlog(L_VB, "Switching to runlevel: %c", foo);
-+		  	if (!quiet) initlog(L_VB, "Switching to runlevel: %c", foo);
++			if (!quiet) initlog(L_VB, "Switching to runlevel: %c", foo);
  	}
  
- 	if (foo == 'Q') return runlevel;
-@@ -2425,7 +2426,7 @@
+ 	if (foo == 'Q') {
+@@ -2598,7 +2599,7 @@ void init_main(void)
    	/*
  	 *	Say hello to the world
  	 */
 -  	initlog(L_CO, bootmsg, "booting");
-+  	if (!quiet) initlog(L_CO, bootmsg, "booting");
++	if (!quiet) initlog(L_CO, bootmsg, "booting");
  
    	/*
  	 *	See if we have to start an emergency shell.
-@@ -2657,6 +2658,8 @@
+@@ -2859,6 +2860,8 @@ int main(int argc, char **argv)
  		else if (!strcmp(argv[f], "-z")) {
  			/* Ignore -z xxx */
  			if (argv[f + 1]) f++;
diff --git a/sysvinit.spec b/sysvinit.spec
index 2c3642c..6b158b9 100644
--- a/sysvinit.spec
+++ b/sysvinit.spec
@@ -1,23 +1,19 @@
 Summary: Programs which control basic system processes
 Name: sysvinit
-Version: 2.87
-Release: 5.dsf%{?dist}
+Version: 2.88
+Release: 1.dsf%{?dist}
 License: GPLv2+
 Group: System Environment/Base
-Source: http://download.savannah.gnu.org/releases/sysvinit/sysvinit-%{version}dsf.tar.gz
+Source: http://download.savannah.gnu.org/releases/sysvinit/sysvinit-%{version}dsf.tar.bz2
 URL: http://savannah.nongnu.org/projects/sysvinit/
 Patch1: sysvinit-2.78-man.patch
 Patch2: sysvinit-2.86-autofsck.patch
 Patch3: sysvinit-2.86-loginshell.patch
 Patch4: sysvinit-2.86-inittab.patch
 Patch5: sysvinit-2.86-single.patch
-Patch6: sysvinit-2.86-quiet.patch
-Patch10: sysvinit-2.87-pidof.patch
-Patch11: sysvinit-2.86-pidof-man.patch
-Patch12: sysvinit-2.87-sulogin.patch
-Patch13: sysvinit-2.87-wide.patch
-Patch14: sysvinit-2.87-ipv6.patch
-Patch15: sysvinit-2.87-omit.patch
+Patch6: sysvinit-2.88-quiet.patch
+Patch14: sysvinit-2.88-ipv6.patch
+Patch15: sysvinit-2.88-omit.patch
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: pam >= 0.66-5
 Requires: filesystem >= 2.2.4-1
@@ -57,22 +53,13 @@ management.
 %patch5 -p1 -b .single
 # Be less verbose when booted with 'quiet'
 %patch6 -p1 -b .quiet
-# Fix various things in pidof - pidof /x/y matching /z/y, pidof -x
-# for scripts, etc.
-%patch10 -p1 -b .pidof
-# Document some of the behavior of pidof. (#201317)
-%patch11 -p1 -b .pidof
-# get_default_context_with_level returns 0 on success (#568530)
-%patch12 -p1 -b .sulogin
-# Add wide output names with -w (#550333)
-%patch13 -p1 -b .wide
 # Change accepted ipv6 addresses (#573346)
 %patch14 -p1 -b .ipv6
 # Add option to pidof to exclude similar processes to omitted processes (#632321)
 %patch15 -p1 -b .omit
 
 %build
-make %{?_smp_mflags} CC="%{__cc}" CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" LDFLAGS="" LCRYPT="-lcrypt" -C src
+make %{?_smp_mflags} CC="%{__cc}" CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" LDFLAGS="-lcrypt" -C src
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -94,6 +81,10 @@ rm -f $RPM_BUILD_ROOT/%{_includedir}/initreq.h
 rm -f $RPM_BUILD_ROOT/%{_mandir}/man5/*
 rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/{halt,init,poweroff,reboot,runlevel,shutdown,telinit}*
 
+# /sbin/fstab-decode is part of initscripts
+rm -f $RPM_BUILD_ROOT/sbin/fstab-decode
+rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/fstab-decode.8
+
 %post
 [ -x /sbin/telinit -a -p /dev/initctl -a -f /proc/1/exe -a -d /proc/1/root ] && /sbin/telinit u
 exit 0


More information about the scm-commits mailing list