Potential issue with && shell operator and upstart command parsing

Scott James Remnant scott at netsplit.com
Mon Oct 27 10:40:37 GMT 2008


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
-- 
Have you ever, ever felt like this?
Had strange things happen?  Are you going round the twist?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/upstart-devel/attachments/20081027/47afcc84/attachment.pgp 


More information about the upstart-devel mailing list