chiark / gitweb /
Treat a trailing backslash as an error
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 18 Dec 2014 22:51:38 +0000 (17:51 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 19 Dec 2014 00:26:21 +0000 (19:26 -0500)
commitba774317ac7d3e67fdb9ed81663264d38859df59
tree09a3c25adb1ac6e16353e4b4ceb89b31575d3949
parent30bcc05295944cfc2f3ed9159592130c003e19f5
Treat a trailing backslash as an error

Commit a2a5291b3f5 changed the parser to reject unfinished quoted
strings. Unfortunately it introduced an error where a trailing
backslash would case an infinite loop. Of course this must fixed, but
the question is what to to instead. Allowing trailing backslashes and
treating them as normal characters would be one option, but this seems
suboptimal. First, there would be inconsistency between handling of
quoting and of backslashes. Second, a trailing backslash is most
likely an error, at it seems better to point it out to the user than
to try to continue.

Updated rules:
ExecStart=/bin/echo \\ → OK, prints a backslash
ExecStart=/bin/echo \ → error
ExecStart=/bin/echo "x → error
ExecStart=/bin/echo "x"y → error
src/shared/util.c
src/test/test-strv.c
src/test/test-util.c