--
James Hunt
____________________________________
http://upstart.ubuntu.com/cookbook
http://upstart.ubuntu.com/cookbook/upstart_cookbook.pdf
=== modified file 'ChangeLog'
--- ChangeLog 2012-03-01 12:18:25 +0000
+++ ChangeLog 2012-03-05 17:29:48 +0000
@@ -1,3 +1,11 @@
+2012-03-05 James Hunt <[email protected]>
+
+ * init/job_process.c: job_process_spawn(): If pty setup fails,
+ log message and disable logging for job.
+ * init/man/init.5: Explain new behaviour should pty setup fail.
+ * init/tests/test_job_process.c: Updated disabled test
+ "when no free ptys" for new behaviour.
+
2012-03-01 James Hunt <[email protected]>
* init/job_class.c:
=== modified file 'init/job_process.c'
--- init/job_process.c 2012-02-03 13:17:24 +0000
+++ init/job_process.c 2012-03-05 17:29:48 +0000
@@ -454,11 +454,23 @@
if (pty_master < 0) {
/* Give the user an indication that they need to
- * increase the available ptys. Any other scenario
- * suggests more serious trouble.
+ * increase the available ptys.
+ *
+ * This error will also been seen when:
+ *
+ * - the kernel does not support ptys.
+ * - /dev/pts mounted, possibly due to an
+ * initramfs-less system.
*/
if (errno == ENOENT)
- nih_warn (_("No available ptys"));
+ nih_error (_("No available ptys"));
+
+ nih_error (_("Failed to create pty - disabling logging"));
+
+ /* Ensure that the job can still be started by
+ * disabling logging.
+ */
+ class->console = CONSOLE_NONE;
close (fds[0]);
close (fds[1]);
=== modified file 'init/man/init.5'
--- init/man/init.5 2012-03-01 12:18:25 +0000
+++ init/man/init.5 2012-03-05 17:29:48 +0000
@@ -668,7 +668,7 @@
.B log
utilizes pseudo-ttys, your kernel must support these. If it does not,
the console value will be modified automatically to
-.BR none.
+.BR none "."
Further, note that it may be necessary to increase the number of
available pty devices; see
.BR pty (7)
@@ -677,6 +677,10 @@
Under Linux, full Unix 98 pty support requires that the
.I devpts
filesystem be mounted.
+
+If pty setup fails for any reason, an error message will be displayed
+and the jobs console value will be reset to
+.BR none "."
.RE
.RE
.sp 1
=== modified file 'init/tests/test_job_process.c'
--- init/tests/test_job_process.c 2012-02-13 12:08:33 +0000
+++ init/tests/test_job_process.c 2012-03-05 17:29:48 +0000
@@ -4735,6 +4735,10 @@
pid = job_process_spawn (job, args, NULL, FALSE, -1);
TEST_LT (pid, 0);
+
+ /* Ensure logging disabled in failure scenarios */
+ TEST_EQ (class->console, CONSOLE_NONE);
+
err = nih_error_get ();
TEST_EQ (err->number, ENOMEM);
nih_free (err);
--
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/upstart-devel