lp:~lool/upstart/document-stop-in-pre-start
- Get this branch:
- bzr branch lp:~lool/upstart/document-stop-in-pre-start
Branch merges
- James Hunt: Approve
- Upstart Developers: Pending requested
-
Diff: 47 lines (+18/-1)2 files modifiedinit/man/init.5 (+4/-1)
util/man/initctl.8 (+14/-0)
Branch information
Recent revisions
- 1363. By Loïc Minier
-
Document start and stop without argument (from pre-stop and pre-start
respectively). - 1362. By Loïc Minier
-
Document using stop command from pre-start (symetric of start during pre-stop).
- 1359. By James Hunt
-
* init/job_class.c:
- job_class_get_instance( ):
- Use nih_local to avoid memory leak should nih_strcat_sprintf( )
fail.
- Formatting.
- job_class_start():
- Use nih_local to avoid memory leak should nih_strcat_sprintf( )
fail.
- Formatting. - 1358. By James Hunt
-
* init/parse_job.c, init/job_class.c, init/job_class.h: Added "usage"
stanza which is used by initctl command.
* init/tests/test_parse_ job.c: Tests for "usage" stanza
* init/man/init.5: "usage" stanza documentation.
* util/initctl.c, util/man/initctl.8: Added "inictl usage" command.
* util/tests/test_initctl. c: Tests for ""inictl usage" command. - 1357. By James Hunt
-
* init/log.c:
- log_flush(): Comments.
- log_read_watch():
- Improved comments.
- Don't re-attempt read on EAGAIN/EWOULDBLOCK since those errors are
nominally impossible due to the remote end of the pty already
having ended (LP: #926468).
- Added a debug-mode warning when 'badly-behaved' application
detected that leaks fds to its children, as this is generally a bug.
* init/tests/test_job_ process. c:
- test_run():
- "with single line command writing fast and exiting": added
waitpid() to ensure no EAGAIN.
- test_spawn():
- "with no such file, no shell and console log": added
waitpid() to ensure no EAGAIN. - 1356. By James Hunt
-
* init/job_process.c: job_process_
spawn() :
- Set close-on-exec for pty_master.
- Ensure stdio buffers flushed prior to forking to ensure no data
leakage to child (should init be run with '--debug', or the tests
be run with redirected output, for example).
- Free log object if child process fails to exec(3) rather than just
closing fd. This ensures io watch is removed correctly. (LP: #922754)
- Only need to remap pty_master if CONSOLE_LOG in operation.
* init/tests/test_job_ process:
- fd_valid(): New helper function to determine if specified fd is valid.
- child(): Added new 'TEST_FDS' test to ensure no fd leakage to child
processes.
- test_run():
- New tests:
- "ensure sane fds with no console, no script"
- "ensure sane fds with no console, and script"
- "ensure sane fds with console log, no script"
- "ensure sane fds with console log, and script"
- "with single-line command running an invalid command, then a 1-line post-stop script"
- "with single-line command running an invalid command, then a 2-line post-stop script"
- "with single-line command running an invalid command, then a post-stop command"
- "with single-line command running an invalid command, then an invalid post-stop command"
- "with single-line command running a valid command, then a 1-line invalid post-stop command"
- Test "with single-line command running an invalid command":
- now diverts stderr output for less chatty test-run experience.
- Improved checking.
- Test "with setuid me" now diverts stderr output for less chatty
test-run experience.
- test_spawn():
- New tests:
- "with no such file, no shell and console log"
- "ensure sane fds with no console"
- "ensure sane fds with console log"
* init/tests/test_log. c: test_log_destroy():
- New test "ensure watch freed when log destroyed" - 1355. By James Hunt
-
* init/tests/
test_job_ process. c: test_run(): Fixed typo in
test "with setuid me" where uid value was being set to gid. - 1354. By James Hunt
-
* init/job_process.c: job_process_
terminated( ): Free log to ensure data
written as soon as _any_ process ends (consider respawn jobs).
* init/log.c:
- log_destroy():
- Improved documentation.
- Now calls new function log_flush().
- log_flush(): New function to ensure no lingering buffered job data
remains. Now considers EBADF (LP: #912558).
- log_io_reader():
- Added missing assert for @len.
- Simplified ENOSPC handling.
- Ensure log->io set to NULL to allow other routines to detect it
really has gone.
- log_file_write(): Added @len checks.
- log_read_watch(): New function to drain data from a watch descriptor
(which also must consider EBADF).
* init/log.h: Added define for LOG_READ_SIZE.
* init/tests/test_job_ process. c:
- test_run():
- Added some extra pointer checks.
- Free class *before* checking file to ensure destructor invoked at
correct point.
- Added test "with single-line command running an invalid command"
(for scenario bug 912558 exposed).
- Added test "with single-line command writing fast and exiting".
* init/tests/test_log. c: Changed all tests to use openpty(3) rather than
pipe(2) for semantic parity with actual code.
* util/tests/test_user_ sessions. sh:
- ensure_no_output(): Now calls check_job_output() and delete_job() to
simplify logic.
- delete_job(): Call get_job_file() rather than doing it long-hand.
- check_job_output(): New function.
- start_job(): Added allow_failure parameter.
- test_ensure_no_unexpected_ output( ): New test
"ensure command job does not create log file with invalid command".
Branch metadata
- Branch format:
- Branch format 7
- Repository format:
- Bazaar repository format 2a (needs bzr 1.16 or later)
- Stacked on:
- lp:upstart