basic/extract-word,man: clarify "correction" of invalid escapes

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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2016-12-10 23:20:42 -05:00
parent 007f48bb89
commit 330785f5ca
2 changed files with 10 additions and 14 deletions

View File

@@ -918,18 +918,14 @@
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

View 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;
}