From 330785f5caf426afa9d93e8eb7dcc7a72d7ea3cb Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Sat, 10 Dec 2016 23:20:42 -0500 Subject: 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. --- man/systemd.service.xml | 20 ++++++++------------ src/basic/extract-word.c | 4 ++-- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/man/systemd.service.xml b/man/systemd.service.xml index 67c68d2f8b..b244a7e970 100644 --- a/man/systemd.service.xml +++ b/man/systemd.service.xml @@ -918,18 +918,14 @@ must be passed as separate words). Lone semicolons may be escaped as \;. - 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 (\) may be used to merge lines. - + 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 (\) may be used to merge lines. This syntax is intended to be very similar to shell syntax, but only the meta-characters and expansions described in the diff --git a/src/basic/extract-word.c b/src/basic/extract-word.c index dbe64a9a58..f8cac3e911 100644 --- a/src/basic/extract-word.c +++ b/src/basic/extract-word.c @@ -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; } -- cgit v1.2.3-54-g00ecf