Skip to content

Commit 330785f

Browse files
committed
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 systemd#4697.
1 parent 007f48b commit 330785f

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

man/systemd.service.xml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -918,18 +918,14 @@
918918
must be passed as separate words). Lone semicolons may be escaped
919919
as <literal>\;</literal>.</para>
920920

921-
<para>Each command line is split on whitespace, with the first
922-
item being the command to execute, and the subsequent items being
923-
the arguments. Double quotes ("...") and single quotes ('...') may
924-
be used, in which case everything until the next matching quote
925-
becomes part of the same argument. C-style escapes are also
926-
supported. The table below contains the list of allowed escape
927-
patterns. Only patterns which match the syntax in the table are
928-
allowed; others will result in an error, and must be escaped by
929-
doubling the backslash. Quotes themselves are removed after
930-
parsing and escape sequences substituted. In addition, a trailing
931-
backslash (<literal>\</literal>) may be used to merge lines.
932-
</para>
921+
<para>Each command line is split on whitespace, with the first item being the command to
922+
execute, and the subsequent items being the arguments. Double quotes ("...") and single quotes
923+
('...') may be used, in which case everything until the next matching quote becomes part of the
924+
same argument. Quotes themselves are removed. C-style escapes are also supported. The table
925+
below contains the list of known escape patterns. Only escape patterns which match the syntax in
926+
the table are allowed; other patterns may be added in the future and unknown patterns will
927+
result in a warning. In particular, any backslashes should be doubled. Finally, a trailing
928+
backslash (<literal>\</literal>) may be used to merge lines.</para>
933929

934930
<para>This syntax is intended to be very similar to shell syntax,
935931
but only the meta-characters and expansions described in the

src/basic/extract-word.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ int extract_first_word_and_warn(
227227
*p = save;
228228
r = extract_first_word(p, ret, separators, flags|EXTRACT_CUNESCAPE_RELAX);
229229
if (r >= 0) {
230-
/* It worked this time, hence it must have been an invalid escape sequence we could correct. */
231-
log_syntax(unit, LOG_WARNING, filename, line, EINVAL, "Invalid escape sequences in line, correcting: \"%s\"", rvalue);
230+
/* It worked this time, hence it must have been an invalid escape sequence. */
231+
log_syntax(unit, LOG_WARNING, filename, line, EINVAL, "Ignoring unknown escape sequences: \"%s\"", *ret);
232232
return r;
233233
}
234234

0 commit comments

Comments
 (0)