BUG/MEDIUM: cli: some err/warn msg dumps add LR into CSV output on stat's CLI
The initial purpose of CSV stats through CLI was to make it easely
parsable by scripts. But in some specific cases some error or warning
messages strings containing LF were dumped into cells of this CSV.
This made some parsing failure on several tools. In addition, if a
warning or message contains to successive LF, they will be dumped
directly but double LFs tag the end of the response on CLI and the
client may consider a truncated response.
This patch extends the 'csv_enc_append' and 'csv_enc' functions used
to format quoted string content according to RFC with an additionnal
parameter to convert multi-lines strings to one line: CRs are skipped,
and LFs are replaced with spaces. In addition and optionally, it is
also possible to remove resulting trailing spaces.
The call of this function to fill strings into stat's CSV output is
updated to force this conversion.
This patch should be backported on all supported branches (issue was
already present in v2.0)
(cherry picked from commit ef02dba7bcf4cf41aaf08fa5cabc8dd2d7537f63)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 5ed535046cdc83ecd4dedec4bda95f2fe268ebd9)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 36e5427803cee410b476fc8280a41ecb6fb9cd0d)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit e56044c0abdedfe6eb4c1fda342e4ffa36d69a66)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 3c23daf0ca5040cc45e32078ef5b9dc767cdaede)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
3 files changed