]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic/extract-word,man: clarify "correction" of invalid escapes 4864/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 11 Dec 2016 04:20:42 +0000 (23:20 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 11 Dec 2016 05:21:36 +0000 (00:21 -0500)
Our warning message was misleading, because we wouldn't "correct" anything,
we'd just ignore unkown escapes. Update the message.

Also, print just the extracted word (which contains the offending sequences) in
the message, instead of the whole line.

Fixes #4697.

man/systemd.service.xml
src/basic/extract-word.c

index 67c68d2f8b5bcd7a98d0604691f38c81374a222e..b244a7e9701e726da87deffc3f1eec57ee1e67f8 100644 (file)
     must be passed as separate words). Lone semicolons may be escaped
     as <literal>\;</literal>.</para>
 
-    <para>Each command line is split on whitespace, with the first
-    item being the command to execute, and the subsequent items being
-    the arguments. Double quotes ("...") and single quotes ('...') may
-    be used, in which case everything until the next matching quote
-    becomes part of the same argument. C-style escapes are also
-    supported. The table below contains the list of allowed escape
-    patterns. Only patterns which match the syntax in the table are
-    allowed; others will result in an error, and must be escaped by
-    doubling the backslash. Quotes themselves are removed after
-    parsing and escape sequences substituted. In addition, a trailing
-    backslash (<literal>\</literal>) may be used to merge lines.
-    </para>
+    <para>Each command line is split on whitespace, with the first item being the command to
+    execute, and the subsequent items being the arguments. Double quotes ("...") and single quotes
+    ('...') may be used, in which case everything until the next matching quote becomes part of the
+    same argument. Quotes themselves are removed. C-style escapes are also supported. The table
+    below contains the list of known escape patterns. Only escape patterns which match the syntax in
+    the table are allowed; other patterns may be added in the future and unknown patterns will
+    result in a warning. In particular, any backslashes should be doubled. Finally, a trailing
+    backslash (<literal>\</literal>) may be used to merge lines.</para>
 
     <para>This syntax is intended to be very similar to shell syntax,
     but only the meta-characters and expansions described in the
index dbe64a9a58eff1765dd5285bba72806b04c2f9d5..f8cac3e911fddef4630ff78eb731077b508089bd 100644 (file)
@@ -227,8 +227,8 @@ int extract_first_word_and_warn(
                 *p = save;
                 r = extract_first_word(p, ret, separators, flags|EXTRACT_CUNESCAPE_RELAX);
                 if (r >= 0) {
-                        /* It worked this time, hence it must have been an invalid escape sequence we could correct. */
-                        log_syntax(unit, LOG_WARNING, filename, line, EINVAL, "Invalid escape sequences in line, correcting: \"%s\"", rvalue);
+                        /* It worked this time, hence it must have been an invalid escape sequence. */
+                        log_syntax(unit, LOG_WARNING, filename, line, EINVAL, "Ignoring unknown escape sequences: \"%s\"", *ret);
                         return r;
                 }