Potential issue with && shell operator and upstart command parsing

Garrett Cooper yanegomi at gmail.com
Mon Oct 27 17:42:00 GMT 2008


On Mon, Oct 27, 2008 at 3:40 AM, Scott James Remnant <scott at netsplit.com> wrote:
> On Sun, 2008-10-26 at 20:36 -0700, Garrett Cooper wrote:
>
>> [10:~]$ cat /etc/init/jobs.d/umasktest_doesntwork
>> umask 777
>>
>> pre-start exec "[ -f /umask_test ] && rm -f /umask_test"
>>
> Why do you have quotes around this?
>
> This will be passed to the shell as the name of a binary to be exec'd
> (so will look for something like
>
>        "/usr/bin/[ -f /umask_test ] && rm -f /umask_test"
>
> which is obviously an illegal filename because of the /s in it).
>
>
> Remove the quotes, and it should work:
>
>        pre-start exec [ -f /umask_test ] && rm -f /umask_test
>
> This is identical to:
>
>        pre-start script
>                exec [ -f /umask_test ] && rm -f /umask_test
>        end script
>
> Scott

Ah, I left the quotes there by accident trying to test out a set of
solutions to see whether or not I could pinpoint the issue.

The issue still persists, which makes me thing that upstart is
evaluating the test statement as a failure and as such pre-start fails
and in the end takes down the rest of the job lifecycle. Is that in
fact the case?

Thanks,
-Garrett

[PEXPECT]# initctl start /etc/init/jobs.d/umasktest_doesntwork
initctl: Unable to start job: Unknown job: /etc/init/jobs.d/umasktest_doesntwork



More information about the upstart-devel mailing list