Bug 86171

Summary: ExecStart with whitespace in path
Product: systemd Reporter: Dennis <mail>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium CC: jonathanboulle
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Dennis 2014-11-11 20:11:17 UTC
I have a service file with a path on ExecStart option that contains whitespaces. 
The manpage suggests to double or single quote the command. 

I have tried every possible combination, but the only thing that works is when you use \x20 for each whitespace.

On errors i get either "main process exited, code=exited, status=203/EXEC" or "Executable path is not absolute, ignoring: ..."

What does not work:

ExecStart=/PATH WITH SPACES/daemon -Param1 -Param2
ExecStart="/PATH WITH SPACES/daemon" -Param1 -Param2
ExecStart="/PATH WITH SPACES/daemon -Param1 -Param2"
ExecStart="/PATH WITH SPACES/daemon" "-Param1 -Param2"
ExecStart="/PATH WITH SPACES/daemon" "-Param1" "-Param2"
ExecStart=/PATH\ WITH\ SPACES/daemon -Param1 -Param2

What does work:

ExecStart=/PATH\x20WITH\x20SPACES/daemon -Param1 -Param2
Comment 1 Zbigniew Jedrzejewski-Szmek 2014-12-19 00:39:58 UTC
I clarified the rules in http://cgit.freedesktop.org/systemd/systemd/commit/?id=c853953658.

ExecStart=/PATH WITH SPACES/daemon -Param1 -Param2        -> 5 args
ExecStart="/PATH WITH SPACES/daemon" -Param1 -Param2      -> 3 args
ExecStart="/PATH WITH SPACES/daemon -Param1 -Param2"      -> 1 arg
ExecStart="/PATH WITH SPACES/daemon" "-Param1 -Param2"    -> 2 args
ExecStart="/PATH WITH SPACES/daemon" "-Param1" "-Param2"  -> 3 args
ExecStart=/PATH\ WITH\ SPACES/daemon -Param1 -Param2      -> error
ExecStart=/PATH\x20WITH\x20SPACES/daemon -Param1 -Param2  -> 3 args

I think that any version which returns 3 args should do the right thing for you.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.