packages: upstart/upstart.spec, upstart/upstart-script_fd.patch (NEW) - pdk...

jajcus jajcus at pld-linux.org
Tue Apr 12 10:09:36 CEST 2011


Author: jajcus                       Date: Tue Apr 12 08:09:36 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- pdksh compatibility fix (https://bugs.launchpad.net/upstart/+bug/757244)
- Release: 2

---- Files affected:
packages/upstart:
   upstart.spec (1.63 -> 1.64) , upstart-script_fd.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/upstart/upstart.spec
diff -u packages/upstart/upstart.spec:1.63 packages/upstart/upstart.spec:1.64
--- packages/upstart/upstart.spec:1.63	Tue Mar 22 19:17:56 2011
+++ packages/upstart/upstart.spec	Tue Apr 12 10:09:31 2011
@@ -11,7 +11,7 @@
 Summary(pl.UTF-8):	Oparty na zdarzeniach demon init
 Name:		upstart
 Version:	1.2
-Release:	1
+Release:	2
 License:	GPL v2
 Group:		Base
 Source0:	http://launchpad.net/upstart/1.x/1.2/+download/%{name}-%{version}.tar.gz
@@ -20,6 +20,7 @@
 Patch0:		pldize.patch
 # https://code.launchpad.net/~jajcus-jajcus/upstart/state-save-stable/+merge/27053/+preview-diff/+files/preview.diff
 Patch1:		%{name}-state_save.patch
+Patch2:		%{name}-script_fd.patch
 Source1:	start-ttys.conf
 Source2:	tty.conf
 Source3:	%{name}.sysconfig
@@ -65,6 +66,7 @@
 %setup -q
 %patch0 -p1
 %{?with_statesave:%patch1 -p0}
+%patch2 -p1
 cp -a %{SOURCE1} conf
 cp -a %{SOURCE2} conf
 
@@ -141,6 +143,10 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.64  2011/04/12 08:09:31  jajcus
+- pdksh compatibility fix (https://bugs.launchpad.net/upstart/+bug/757244)
+- Release: 2
+
 Revision 1.63  2011/03/22 18:17:56  arekm
 - up to 1.2; shell redirection fix that broke 1.1
 

================================================================
Index: packages/upstart/upstart-script_fd.patch
diff -u /dev/null packages/upstart/upstart-script_fd.patch:1.1
--- /dev/null	Tue Apr 12 10:09:36 2011
+++ packages/upstart/upstart-script_fd.patch	Tue Apr 12 10:09:31 2011
@@ -0,0 +1,78 @@
+diff -dur upstart-1.2.orig/init/job_process.c upstart-1.2/init/job_process.c
+--- upstart-1.2.orig/init/job_process.c	2011-03-22 18:18:00.000000000 +0100
++++ upstart-1.2/init/job_process.c	2011-04-11 10:31:56.000000000 +0200
+@@ -208,12 +208,8 @@
+ 
+ 			shell = TRUE;
+ 
+-			/* FIXME actually always want it to be /proc/self/fd/3 and
+-			 * dup2() in the child to make it that way ... no way
+-			 * of passing that yet
+-			 */
+ 			cmd = NIH_MUST (nih_sprintf (argv, "%s/%d",
+-						     "/proc/self/fd", fds[0]));
++						     "/proc/self/fd", 3));
+ 			NIH_MUST (nih_str_array_addp (&argv, NULL,
+ 						      &argc, cmd));
+ 		}
+@@ -259,7 +255,7 @@
+ 
+ 	/* Spawn the process, repeat until fork() works */
+ 	while ((job->pid[process] = job_process_spawn (job->class, argv,
+-						       env, trace)) < 0) {
++				       env, trace, shell?fds[0]:-1)) < 0) {
+ 		NihError *err;
+ 
+ 		err = nih_error_get ();
+@@ -321,7 +317,7 @@
+ 		 * a path. Instruct the shell to close this extra fd and
+ 		 * not to leak it.
+ 		 */
+-		NIH_ZERO (nih_io_printf (io, "exec %d<&-\n", fds[0]));
++		NIH_ZERO (nih_io_printf (io, "exec 3<&-\n"));
+ 
+ 		NIH_ZERO (nih_io_write (io, script, strlen (script)));
+ 		nih_io_shutdown (io);
+@@ -337,6 +333,7 @@
+  * @argv: NULL-terminated list of arguments for the process,
+  * @env: NULL-terminated list of environment variables for the process,
+  * @trace: whether to trace this process.
++ * @fd3: file descriptor to dup2() to descriptor 3
+  *
+  * This function spawns a new process using the @class details to set up the
+  * environment for it; the process is always a session and process group
+@@ -367,7 +364,8 @@
+ job_process_spawn (JobClass     *class,
+ 		   char * const  argv[],
+ 		   char * const *env,
+-		   int           trace)
++		   int           trace,
++		   int		 fd3)
+ {
+ 	sigset_t  child_set, orig_set;
+ 	pid_t     pid;
+@@ -566,6 +564,12 @@
+ 		}
+ 	}
+ 
++	/* move the script input to file descriptor #3 */
++	if (fd3 > 3) {
++		dup2(fd3, 3);
++		close(fd3);
++	}	
++
+ 	/* Execute the process, if we escape from here it failed */
+ 	if (execvp (argv[0], argv) < 0) {
+ 		nih_error_raise_system ();
+diff -dur upstart-1.2.orig/init/job_process.h upstart-1.2/init/job_process.h
+--- upstart-1.2.orig/init/job_process.h	2011-02-01 19:42:30.000000000 +0100
++++ upstart-1.2/init/job_process.h	2011-04-11 10:26:33.000000000 +0200
+@@ -80,7 +80,7 @@
+ int    job_process_run     (Job *job, ProcessType process);
+ 
+ pid_t  job_process_spawn   (JobClass *class, char * const argv[],
+-			    char * const *env, int trace)
++			    char * const *env, int trace, int fd3)
+ 	__attribute__ ((warn_unused_result));
+ 
+ void   job_process_kill    (Job *job, ProcessType process);
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/upstart/upstart.spec?r1=1.63&r2=1.64&f=u



More information about the pld-cvs-commit mailing list