The problem is in init/job_process.c, function job_process_run().
Upstart detects SHELL_CHARS in the exec line, so first time
it launches command with shell and exec wrappings
/bin/sh -e -c exec /bin/sh -c "exit"
and set "script" flag for the job's MAIN_PROCESS.
During the second "initctl start" and job_process_run
the "script" flags is set so the following line is passed
to job_process_span and execve
/bin/sh -e -c /bin/sh -c "exit"
Because of absent "exec", shell forks, it is caught by
handler, so upstart believes that daemon has been started.
It seems that "proc->script = TRUE;" should not be set.
The problem is in init/job_process.c, function job_process_run().
Upstart detects SHELL_CHARS in the exec line, so first time
it launches command with shell and exec wrappings
/bin/sh -e -c exec /bin/sh -c "exit"
and set "script" flag for the job's MAIN_PROCESS.
During the second "initctl start" and job_process_run
the "script" flags is set so the following line is passed
to job_process_span and execve
/bin/sh -e -c /bin/sh -c "exit"
Because of absent "exec", shell forks, it is caught by
handler, so upstart believes that daemon has been started.
It seems that "proc->script = TRUE;" should not be set.