Merge authors:
  Stéphane Graber (stgraber)
Related merge proposals:
  https://code.launchpad.net/~stgraber/upstart/upstart-shell-exec/+merge/140233
  proposed by: Stéphane Graber (stgraber)
  review: Approve - James Hunt (jamesodhunt)
------------------------------------------------------------
revno: 1411 [merge]
committer: James Hunt <[email protected]>
branch nick: upstart
timestamp: Mon 2012-12-17 15:53:01 +0000
message:
  * Merge of lp:~stgraber/upstart/upstart-shell-exec.
modified:
  init/job_process.c


--
lp:upstart
https://code.launchpad.net/~upstart-devel/upstart/trunk

Your team Upstart Reviewers is subscribed to branch lp:upstart.
To unsubscribe from this branch go to 
https://code.launchpad.net/~upstart-devel/upstart/trunk/+edit-subscription
=== modified file 'init/job_process.c'
--- init/job_process.c	2012-12-17 11:36:46 +0000
+++ init/job_process.c	2012-12-17 15:53:01 +0000
@@ -178,18 +178,11 @@
 	nih_assert (proc != NULL);
 	nih_assert (proc->command != NULL);
 
-
-	/* If the command string contains any shell-like characters,
-	 * automatically set script = TRUE since that's the best way to deal
-	 * with things like variables.
-	 */
-	if (strpbrk (proc->command, SHELL_CHARS))
-		proc->script = TRUE;
-
 	/* We run the process using a shell if it says it wants to be run
-	 * as such.
+	 * as such, or if it contains any shell-like characters; since that's
+	 * the best way to deal with things like variables.
 	 */
-	if (proc->script) {
+	if ((proc->script) || strpbrk (proc->command, SHELL_CHARS)) {
 		char *nl, *p;
 
 		argc = 0;
@@ -246,6 +239,12 @@
 			NIH_MUST (nih_str_array_addp (&argv, NULL,
 						      &argc, cmd));
 		}
+
+		/* At the end, always set proc->script to TRUE, even if the user didn't
+		 * explicitly set it (when using shell variables). That way tests
+		 * can reliably check for shell-specific behaviour.
+		 */
+		proc->script = TRUE;
 	} else {
 		/* Split the command on whitespace to produce a list of
 		 * arguments that we can exec directly.

-- 
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to