[Pkg-systemd-maintainers] Bug#732156: Bug#732156: Precise documentation for ExecStart command syntax

Michael Stapelberg stapelberg at debian.org
Sat Dec 14 22:18:55 GMT 2013


Hi Ian,

Ian Jackson <ijackson at chiark.greenend.org.uk> writes:
> Reading systemd.service(5), I'm confused about the exact syntax and
> quoting for the "ExecStart=" directive.
>
> AFAICT from reading systemd.unit(5), the values in the unit file
> general syntax are whatever comes after the =, and it is up to the
> particular directive to specify the interpretation of the RHS.
>
> ExecStart talks about multiple commands being separated by semicolons.
> It also talks about "the first argument" but it doesn't specify how
> arguments are split.  It tells us that shell syntax is not used.  But
> it provides this example:
>
>     ExecStart=/bin/sh -c 'dmesg | tac'
>
> If that example is correct, something nontrivial must be going on.
> I think it should be documented.
To clarify: the mapping of directives to parsing function happens in
http://cgit.freedesktop.org/systemd/systemd/tree/src/core/load-fragment-gperf.gperf.m4?id=9091e686f43184065381aa71929e3df36a4ea2e1#n150

The relevant parsing function is config_parse_exec():
http://cgit.freedesktop.org/systemd/systemd/tree/src/core/load-fragment.c?id=9091e686f43184065381aa71929e3df36a4ea2e1#n433

Arguments are split on WHITESPACE, which is “ \t\n\r”:
http://cgit.freedesktop.org/systemd/systemd/tree/src/shared/util.h?id=9091e686f43184065381aa71929e3df36a4ea2e1#n53

I presume changing the wording of systemd.service(5) to read “Commands
with their (whitespace-separated) arguments […]” would clarify. Do you
agree? If so, I’ll send a patch upstream to change this.

-- 
Best regards,
Michael




More information about the Pkg-systemd-maintainers mailing list