James Hunt has proposed merging lp:~jamesodhunt/upstart/restrict-debug-stanza into lp:upstart.
Requested reviews: Upstart Reviewers (upstart-reviewers) For more details, see: https://code.launchpad.net/~jamesodhunt/upstart/restrict-debug-stanza/+merge/204363 Creating a job with a debug stanza will stop stateful re-exec from working reliably since the child is paused before exec'ing such that it still retains a copy of the parents file descriptors. This is legitimate since that is the whole point of the unofficial debug stanza. Since the debug stanza is only to be used for development, no production job should be using it and in fact no production version of Upstart that supports stateful re-exec can be using it due to the problems it causes with re-exec. As such, this branch makes the debug stanza a NOP unless upstart was *started* with --debug. -- https://code.launchpad.net/~jamesodhunt/upstart/restrict-debug-stanza/+merge/204363 Your team Upstart Reviewers is requested to review the proposed merge of lp:~jamesodhunt/upstart/restrict-debug-stanza into lp:upstart.
=== modified file 'ChangeLog' --- ChangeLog 2014-01-22 11:16:20 +0000 +++ ChangeLog 2014-01-31 23:49:11 +0000 @@ -1,3 +1,11 @@ +2014-01-31 James Hunt <[email protected]> + + * 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-01-22 James Hunt <[email protected]> * init/main.c: logger_kmsg(): Use open(2) rather than fopen(3) to avoid === 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:49:11 +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:49:11 +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:49:11 +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
