[systemd-devel] [PATCH] util: Fix assertion in split() on missing '

Lennart Poettering lennart at poettering.net
Wed Apr 22 16:18:10 PDT 2015


On Wed, 22.04.15 23:20, Martin Pitt (martin.pitt at ubuntu.com) wrote:

> Hello all,
> 
> today I got a report about crashing systemd (pid 1) by installing a
> package with a broken unit file. Rebooting also doesn't work as
> systemd immediately crashes again. It turns out the unit file used a
> multi-line ExecStart= with ' quoting where the author (accidentally)
> added a trailing slash after the usual \ escaping of the newline:
> 
> ---------- snip ---------
> [Unit]
> Description=test
> 
> [Service]
> ExecStart=/bin/echo 'foo \ 
>     bar'
> ---------- snip ---------
> 
> Instead of actually breaking your machine, you can just copy that unit
> to e. g. /tmp and then run "systemd-analyze verify test.service" to
> get the same assertion.
> 
> Of course this syntax is invalid, but systemd certainly shouldn't
> spill its guts that hard, but just reject the broken .service file.
> 
> Simple fix with test case attached.

Thanks! Applied!

We really should get rid of split() entirely. The code is ugly, and it
pretends to do quoting, but actually doesn't do it properly. An
unquote_first_word() loop is really the much better option.

Would love if somebody would sit down and port this all over...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list