Merge authors:
  James Hunt (jamesodhunt)
Related merge proposals:
  
https://code.launchpad.net/~jamesodhunt/upstart/restrict-debug-stanza/+merge/204363
  proposed by: James Hunt (jamesodhunt)
------------------------------------------------------------
revno: 1605 [merge]
committer: Dimitri John Ledkov <[email protected]>
branch nick: trunk
timestamp: Thu 2014-03-06 14:25:46 +0000
message:
  merge lp:~jamesodhunt/upstart/restrict-debug-stanza
modified:
  ChangeLog
  init/job_process.c
  init/main.c
  init/parse_job.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 'ChangeLog'
--- ChangeLog	2014-03-06 13:57:47 +0000
+++ ChangeLog	2014-03-06 14:25:46 +0000
@@ -7,6 +7,11 @@
 	  tests (LP: #1288243).
 	* util/tests/test_initctl.c: Revert to looking for "init' rather than
 	  'test_init'.
+	* init/job_process.c: job_process_spawn(): Comments.
+	* init/main.c: main(): Enable the debug stanza when booting with
+	  '--debug' (switching log-level will not work).
+	* init/parse_job.c: stanza_debug(): Conditionally disable the debug
+	  stanza.
 
 2014-03-06  James Hunt  <[email protected]>
 

=== modified file 'init/job_process.c'
--- init/job_process.c	2013-11-03 02:54:03 +0000
+++ init/job_process.c	2014-01-31 23:45:02 +0000
@@ -915,6 +915,12 @@
 	 *   fail. Note that closing the pipe means from this point onwards,
 	 *   the parent cannot know the true outcome of the spawn: that
 	 *   responsibility lies with the debugger.
+	 *
+	 * - note that running with the debug stanza enabled will
+	 *   unavoidably stop stateful re-exec from working correctly
+	 *   since the stopped debug child process will hold copies of
+	 *   the parents file descriptors open until it continues to
+	 *   call exec below.
 	 */
 	if (class->debug) {
 		close (fds[1]);

=== modified file 'init/main.c'
--- init/main.c	2014-01-22 13:49:01 +0000
+++ init/main.c	2014-01-31 23:45:02 +0000
@@ -138,6 +138,7 @@
 extern char        *log_dir;
 extern DBusBusType  dbus_bus_type;
 extern mode_t       initial_umask;
+extern int          debug_stanza_enabled;
 
 /**
  * options:
@@ -219,6 +220,9 @@
 	if (! args)
 		exit (1);
 
+	if (nih_log_priority == NIH_LOG_DEBUG)
+		debug_stanza_enabled = TRUE;
+
 	handle_confdir ();
 	handle_logdir ();
 

=== modified file 'init/parse_job.c'
--- init/parse_job.c	2013-07-21 23:54:16 +0000
+++ init/parse_job.c	2014-01-31 23:45:02 +0000
@@ -240,7 +240,12 @@
 			       size_t *pos, size_t *lineno)
 	__attribute__ ((warn_unused_result));
 
-
+/**
+ * debug_stanza_enabled:
+ *
+ * If TRUE, honour the debug stanza, else consider it a NOP.
+ **/
+int debug_stanza_enabled = FALSE;
 
 /**
  * stanzas:
@@ -1084,7 +1089,8 @@
 	nih_assert (file != NULL);
 	nih_assert (pos != NULL);
 
-	class->debug = TRUE;
+	if (debug_stanza_enabled)
+		class->debug = TRUE;
 
 	return 0;
 }

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

Reply via email to